FindITK.cmake 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. FIND_PACKAGE(ITK QUIET NO_MODULE
  38. NAMES ITK InsightToolkit
  39. CONFIGS ITKConfig.cmake
  40. )
  41. ENDIF()
  42. SET(ITK_DIR_MESSAGE "Please set ITK_DIR to the directory containing ITKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/InsightToolkit for an installation.")
  43. IF(ITK_FOUND)
  44. # Set USE_ITK_FILE for backward-compatability.
  45. SET(USE_ITK_FILE ${ITK_USE_FILE})
  46. ELSEIF(ITK_FIND_REQUIRED)
  47. MESSAGE(FATAL_ERROR ${ITK_DIR_MESSAGE})
  48. ELSEIF(NOT ITK_FIND_QUIETLY)
  49. MESSAGE(STATUS ${ITK_DIR_MESSAGE})
  50. ENDIF()