1 # - Find a GDCM installation or build tree.
2 # The following variables are set if GDCM is found. If GDCM is not
3 # found, GDCM_FOUND is set to false.
4 # GDCM_FOUND - Set to true when GDCM is found.
5 # GDCM_USE_FILE - CMake file to use GDCM.
6 # GDCM_MAJOR_VERSION - The GDCM major version number.
7 # GDCM_MINOR_VERSION - The GDCM minor version number
9 # GDCM_BUILD_VERSION - The GDCM patch level
10 # (meaningless for odd minor).
11 # GDCM_INCLUDE_DIRS - Include directories for GDCM
12 # GDCM_LIBRARY_DIRS - Link directories for GDCM libraries
13 # GDCM_KITS - List of GDCM kits, in CAPS
15 # GDCM_LANGUAGES - List of wrapped languages, in CAPS
17 # The following cache entries must be set by the user to locate GDCM:
18 # GDCM_DIR - The directory containing GDCMConfig.cmake.
19 # This is either the root of the build tree,
20 # or the lib/vtk directory. This is the
24 # Construct consitent error messages for use below.
25 SET(GDCM_DIR_DESCRIPTION "directory containing GDCMConfig.cmake. This is either the root of the build tree, or PREFIX/lib/GDCM for an installation.")
26 SET(GDCM_DIR_MESSAGE "GDCM not found. Set the GDCM_DIR cmake cache entry to the ${GDCM_DIR_DESCRIPTION}")
28 # Search only if the location is not already known.
30 # Get the system search path as a list.
32 STRING(REGEX MATCHALL "[^:]+" GDCM_DIR_SEARCH1 "$ENV{PATH}")
34 STRING(REGEX REPLACE "\\\\" "/" GDCM_DIR_SEARCH1 "$ENV{PATH}")
36 STRING(REGEX REPLACE "/;" ";" GDCM_DIR_SEARCH2 "${GDCM_DIR_SEARCH1}")
38 # Construct a set of paths relative to the system search path.
39 SET(GDCM_DIR_SEARCH "")
40 FOREACH(dir ${GDCM_DIR_SEARCH2})
41 SET(GDCM_DIR_SEARCH ${GDCM_DIR_SEARCH}
47 # Look for an installation or build tree.
49 FIND_PATH(GDCM_DIR GDCMConfig.cmake
50 # Look for an environment variable GDCM_DIR.
53 # Look in places relative to the system executable search path.
56 # Look in standard UNIX install locations.
60 # Read from the CMakeSetup registry entries. It is likely that
61 # GDCM will have been recently built.
62 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
63 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
64 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
65 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
66 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
67 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
68 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
69 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
70 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
71 [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
73 # Help the user find it if we cannot.
74 DOC "The ${GDCM_DIR_DESCRIPTION}"
78 # If GDCM was found, load the configuration file to get the rest of the
81 # Make sure the GDCMConfig.cmake file exists in the directory provided.
82 IF(EXISTS ${GDCM_DIR}/GDCMConfig.cmake)
84 # We found GDCM. Load the settings.
86 INCLUDE(${GDCM_DIR}/GDCMConfig.cmake)
88 ENDIF(EXISTS ${GDCM_DIR}/GDCMConfig.cmake)
90 # We did not find GDCM.
94 #-----------------------------------------------------------------------------
96 # GDCM not found, explain to the user how to specify its location.
97 IF(NOT GDCM_FIND_QUIETLY)
98 MESSAGE(FATAL_ERROR ${GDCM_DIR_MESSAGE})
99 ELSE(NOT GDCM_FIND_QUIETLY)
100 IF(GDCM_FIND_REQUIRED)
101 MESSAGE(FATAL_ERROR ${GDCM_DIR_MESSAGE})
102 ENDIF(GDCM_FIND_REQUIRED)
103 ENDIF(NOT GDCM_FIND_QUIETLY)
104 ENDIF(NOT GDCM_FOUND)