FindITK.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # - Find an ITK installation or build tree.
  2. # When ITK is found, the ITKConfig.cmake file is sourced to setup the
  3. # location and configuration of ITK. Please read this file, or
  4. # ITKConfig.cmake.in from the ITK source tree for the full list of
  5. # definitions. Of particular interest is ITK_USE_FILE, a CMake source file
  6. # that can be included to set the include directories, library directories,
  7. # and preprocessor macros. In addition to the variables read from
  8. # ITKConfig.cmake, this find module also defines
  9. # ITK_DIR - The directory containing ITKConfig.cmake.
  10. # This is either the root of the build tree,
  11. # or the lib/InsightToolkit directory.
  12. # This is the only cache entry.
  13. #
  14. # ITK_FOUND - Whether ITK was found. If this is true,
  15. # ITK_DIR is okay.
  16. #
  17. # USE_ITK_FILE - The full path to the UseITK.cmake file.
  18. # This is provided for backward
  19. # compatability. Use ITK_USE_FILE
  20. # instead.
  21. #=============================================================================
  22. # Copyright 2001-2010 Kitware, Inc.
  23. #
  24. # Distributed under the OSI-approved BSD License (the "License");
  25. # see accompanying file Copyright.txt for details.
  26. #
  27. # This software is distributed WITHOUT ANY WARRANTY; without even the
  28. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  29. # See the License for more information.
  30. #=============================================================================
  31. # (To distribute this file outside of CMake, substitute the full
  32. # License text for the above reference.)
  33. # Use the Config mode of the find_package() command to find ITKConfig.
  34. # If this succeeds (possibly because ITK_DIR is already set), the
  35. # command will have already loaded ITKConfig.cmake and set ITK_FOUND.
  36. if(NOT ITK_FOUND)
  37. set(_ITK_REQUIRED "")
  38. if(ITK_FIND_REQUIRED)
  39. set(_ITK_REQUIRED REQUIRED)
  40. endif()
  41. set(_ITK_QUIET "")
  42. if(ITK_FIND_QUIETLY)
  43. set(_ITK_QUIET QUIET)
  44. endif()
  45. find_package(ITK ${_ITK_REQUIRED} ${_ITK_QUIET} NO_MODULE
  46. NAMES ITK InsightToolkit
  47. CONFIGS ITKConfig.cmake
  48. )
  49. endif()
  50. if(ITK_FOUND)
  51. # Set USE_ITK_FILE for backward-compatability.
  52. set(USE_ITK_FILE ${ITK_USE_FILE})
  53. endif()