2005-12-14 21:51:08 +03:00
# - Find an ITK installation or build tree.
2005-12-15 18:41:19 +03:00
2002-11-07 02:40:13 +03:00
# When ITK is found, the ITKConfig.cmake file is sourced to setup the
# location and configuration of ITK. Please read this file, or
# ITKConfig.cmake.in from the ITK source tree for the full list of
2005-12-15 18:41:19 +03:00
# definitions. Of particular interest is ITK_USE_FILE, a CMake source file
# that can be included to set the include directories, library directories,
# and preprocessor macros. In addition to the variables read from
# ITKConfig.cmake, this find module also defines
# ITK_DIR - The directory containing ITKConfig.cmake.
# This is either the root of the build tree,
# or the lib/InsightToolkit directory.
# This is the only cache entry.
2005-12-14 21:51:08 +03:00
#
2005-12-15 18:41:19 +03:00
# ITK_FOUND - Whether ITK was found. If this is true,
# ITK_DIR is okay.
2005-12-14 21:51:08 +03:00
#
# USE_ITK_FILE - The full path to the UseITK.cmake file.
2005-12-15 18:41:19 +03:00
# This is provided for backward
# compatability. Use ITK_USE_FILE
# instead.
2005-12-14 21:51:08 +03:00
2009-10-02 01:21:28 +04:00
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
2002-11-07 02:40:13 +03:00
2004-04-21 19:33:47 +04:00
SET ( ITK_DIR_STRING "directory containing ITKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/InsightToolkit for an installation." )
2002-11-07 02:40:13 +03:00
# Search only if the location is not already known.
IF ( NOT ITK_DIR )
# Get the system search path as a list.
IF ( UNIX )
2004-04-15 01:02:40 +04:00
STRING ( REGEX MATCHALL "[^:]+" ITK_DIR_SEARCH1 "$ENV{PATH}" )
2002-11-07 02:40:13 +03:00
ELSE ( UNIX )
2004-04-15 01:02:40 +04:00
STRING ( REGEX REPLACE "\\\\" "/" ITK_DIR_SEARCH1 "$ENV{PATH}" )
2002-11-07 02:40:13 +03:00
ENDIF ( UNIX )
STRING ( REGEX REPLACE "/;" ";" ITK_DIR_SEARCH2 ${ ITK_DIR_SEARCH1 } )
# Construct a set of paths relative to the system search path.
SET ( ITK_DIR_SEARCH "" )
FOREACH ( dir ${ ITK_DIR_SEARCH2 } )
SET ( ITK_DIR_SEARCH ${ ITK_DIR_SEARCH } "${dir}/../lib/InsightToolkit" )
ENDFOREACH ( dir )
#
# Look for an installation or build tree.
#
FIND_PATH ( ITK_DIR ITKConfig.cmake
2004-04-26 19:00:41 +04:00
# Look for an environment variable ITK_DIR.
$ E N V { I T K _ D I R }
2002-11-07 02:40:13 +03:00
# Look in places relative to the system executable search path.
$ { I T K _ D I R _ S E A R C H }
# Look in standard UNIX install locations.
/ u s r / l o c a l / l i b / I n s i g h t T o o l k i t
/ u s r / l i b / I n s i g h t T o o l k i t
# Read from the CMakeSetup registry entries. It is likely that
# ITK will have been recently built.
2001-10-27 02:21:53 +04:00
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 1 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 2 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 3 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 4 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 5 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 6 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 7 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 8 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 9 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 1 0 ]
2002-11-07 02:40:13 +03:00
# Help the user find it if we cannot.
2004-04-21 19:33:47 +04:00
D O C " T h e $ { I T K _ D I R _ S T R I N G } "
2002-11-07 02:40:13 +03:00
)
ENDIF ( NOT ITK_DIR )
2001-10-27 02:21:53 +04:00
2002-11-07 02:40:13 +03:00
# If ITK was found, load the configuration file to get the rest of the
# settings.
IF ( ITK_DIR )
SET ( ITK_FOUND 1 )
INCLUDE ( ${ ITK_DIR } /ITKConfig.cmake )
2001-10-27 02:21:53 +04:00
2002-11-07 02:40:13 +03:00
# Set USE_ITK_FILE for backward-compatability.
SET ( USE_ITK_FILE ${ ITK_USE_FILE } )
ELSE ( ITK_DIR )
SET ( ITK_FOUND 0 )
2004-04-21 19:33:47 +04:00
IF ( ITK_FIND_REQUIRED )
MESSAGE ( FATAL_ERROR "Please set ITK_DIR to the ${ITK_DIR_STRING}" )
ENDIF ( ITK_FIND_REQUIRED )
2002-11-07 02:40:13 +03:00
ENDIF ( ITK_DIR )