Merge topic 'FindITK-passthru'

aa170c2 FindITK: Use passthru find_package config mode for messages
This commit is contained in:
Brad King 2011-04-19 14:08:20 -04:00 committed by CMake Topic Stage
commit 2b44534950
1 changed files with 9 additions and 7 deletions

View File

@ -37,19 +37,21 @@
# If this succeeds (possibly because ITK_DIR is already set), the # If this succeeds (possibly because ITK_DIR is already set), the
# command will have already loaded ITKConfig.cmake and set ITK_FOUND. # command will have already loaded ITKConfig.cmake and set ITK_FOUND.
IF(NOT ITK_FOUND) IF(NOT ITK_FOUND)
FIND_PACKAGE(ITK QUIET NO_MODULE SET(_ITK_REQUIRED "")
IF(ITK_FIND_REQUIRED)
SET(_ITK_REQUIRED REQUIRED)
ENDIF()
SET(_ITK_QUIET "")
IF(ITK_FIND_QUIETLY)
SET(_ITK_QUIET QUIET)
ENDIF()
FIND_PACKAGE(ITK ${_ITK_REQUIRED} ${_ITK_QUIET} NO_MODULE
NAMES ITK InsightToolkit NAMES ITK InsightToolkit
CONFIGS ITKConfig.cmake CONFIGS ITKConfig.cmake
) )
ENDIF() ENDIF()
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.")
IF(ITK_FOUND) IF(ITK_FOUND)
# Set USE_ITK_FILE for backward-compatability. # Set USE_ITK_FILE for backward-compatability.
SET(USE_ITK_FILE ${ITK_USE_FILE}) SET(USE_ITK_FILE ${ITK_USE_FILE})
ELSEIF(ITK_FIND_REQUIRED)
MESSAGE(FATAL_ERROR ${ITK_DIR_MESSAGE})
ELSEIF(NOT ITK_FIND_QUIETLY)
MESSAGE(STATUS ${ITK_DIR_MESSAGE})
ENDIF() ENDIF()