1 # Generate the GDCMConfig.cmake file in the build tree. Also configure
2 # one for installation. The file tells external projects how to use
5 # Help store a literal dollar in a string. CMake 2.2 allows escaped
6 # dollars but we have to support CMake 2.0.
9 #-----------------------------------------------------------------------------
10 # Settings shared between the build tree and install tree.
12 EXPORT_LIBRARY_DEPENDENCIES(
13 ${GDCM_BINARY_DIR}/GDCMLibraryDepends.cmake)
14 INCLUDE(${CMAKE_ROOT}/Modules/CMakeExportBuildSettings.cmake)
15 CMAKE_EXPORT_BUILD_SETTINGS(
16 ${GDCM_BINARY_DIR}/GDCMBuildSettings.cmake)
18 IF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
19 INSTALL_FILES(${GDCM_INSTALL_PACKAGE_DIR} FILES
20 ${CMAKE_CURRENT_SOURCE_DIR}/UseGDCM.cmake
21 ${GDCM_BINARY_DIR}/GDCMLibraryDepends.cmake
22 ${GDCM_BINARY_DIR}/GDCMBuildSettings.cmake
24 ENDIF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
26 #-----------------------------------------------------------------------------
27 # Settings specific to the build tree.
29 # The install-only section is empty for the build tree.
30 SET(GDCM_CONFIG_INSTALL_ONLY)
33 SET(GDCM_USE_FILE_CONFIG
34 ${CMAKE_CURRENT_SOURCE_DIR}/UseGDCM.cmake)
36 # The build settings file.
37 SET(GDCM_BUILD_SETTINGS_FILE_CONFIG
38 ${GDCM_BINARY_DIR}/GDCMBuildSettings.cmake)
40 # The library directories.
41 SET(GDCM_LIBRARY_DIRS_CONFIG ${GDCM_LIBRARY_DIRS})
43 # The runtime directories.
44 SET(GDCM_RUNTIME_DIRS_CONFIG ${GDCM_RUNTIME_DIRS})
46 # The include directories.
47 SET(GDCM_INCLUDE_DIRS_CONFIG ${GDCM_INCLUDE_PATH})
49 # The library dependencies file.
50 SET(GDCM_LIBRARY_DEPENDS_FILE
51 ${GDCM_BINARY_DIR}/GDCMLibraryDepends.cmake)
54 SET(GDCM_DATA_DIR_CONFIG
58 SET(GDCM_EXAMPLES_DIR_CONFIG
62 #SET(GDCM_TEMPLATES_DIR_CONFIG
63 # ${GDCM_TEMPLATES_DIR})
66 #SET(GDCM_RESOURCES_DIR_CONFIG
67 # ${GDCM_RESOURCES_DIR})
69 # The CMake macros dir.
70 SET(GDCM_CMAKE_DIR_CONFIG
74 #SET(GDCM_TCL_PACKAGE_INDEX_DIR_CONFIG ${GDCM_TCL_PACKAGE_INDEX_DIR})
77 SET(GDCM_PYTHON_MODULE_DIR_CONFIG ${GDCM_PYTHON_MODULE_DIR})
79 # The Doxygen options.
80 SET(GDCM_DOXYGEN_DIR_CONFIG ${GDCM_SOURCE_DIR}/Utilities/Doxygen)
83 SET(GDCM_VTK_DIR_CONFIG ${VTK_DIR})
85 # The build configuration information.
86 SET(GDCM_CONFIGURATION_TYPES_CONFIG ${GDCM_CONFIGURATION_TYPES})
87 SET(GDCM_BUILD_TYPE_CONFIG ${CMAKE_BUILD_TYPE})
89 # Configure GDCMConfig.cmake for the build tree.
91 ${CMAKE_CURRENT_SOURCE_DIR}/GDCMConfig.cmake.in
92 ${GDCM_BINARY_DIR}/GDCMConfig.cmake @ONLY IMMEDIATE)
94 #-----------------------------------------------------------------------------
95 # Settings specific to the install tree.
98 SET(GDCM_USE_FILE_CONFIG
99 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_PACKAGE_DIR}/UseGDCM.cmake)
101 # The build settings file.
102 SET(GDCM_BUILD_SETTINGS_FILE_CONFIG
103 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_PACKAGE_DIR}/GDCMBuildSettings.cmake)
105 # The library directories.
106 IF(CYGWIN AND GDCM_BUILD_SHARED_LIBS)
107 # In Cygwin programs directly link to the .dll files.
108 SET(GDCM_LIBRARY_DIRS_CONFIG
109 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_BIN_DIR})
110 ELSE(CYGWIN AND GDCM_BUILD_SHARED_LIBS)
111 SET(GDCM_LIBRARY_DIRS_CONFIG
112 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_LIB_DIR})
113 ENDIF(CYGWIN AND GDCM_BUILD_SHARED_LIBS)
115 # The runtime directories.
117 SET(GDCM_RUNTIME_DIRS_CONFIG
118 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_BIN_DIR})
120 SET(GDCM_RUNTIME_DIRS_CONFIG
121 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_LIB_DIR})
124 # The include directories.
125 SET(GDCM_INCLUDE_DIRS_CONFIG
126 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_INCLUDE_DIR})
128 # The library dependencies file.
129 SET(GDCM_LIBRARY_DEPENDS_FILE
130 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_PACKAGE_DIR}/GDCMLibraryDepends.cmake)
134 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_DATA_DIR}/Data)
137 SET(GDCM_EXAMPLES_DIR_CONFIG
138 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_DATA_DIR}/Examples)
141 #SET(GDCM_TEMPLATES_DIR_CONFIG
142 # ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_INCLUDE_DIR}/Templates)
145 #SET(GDCM_RESOURCES_DIR_CONFIG
146 # ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_DATA_DIR}/Resources)
148 # The CMake macros dir.
149 SET(GDCM_CMAKE_DIR_CONFIG
150 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_PACKAGE_DIR}/CMake)
152 # The Tcl/Tk options.
153 #SET(GDCM_TCL_PACKAGE_INDEX_DIR_CONFIG
154 # ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_LIB_DIR}/tcl)
156 # The Python options.
158 # SET(python_subdir "")
160 # IF(PYTHON_EXECUTABLE)
161 # EXEC_PROGRAM("${PYTHON_EXECUTABLE}" ARGS "-V" OUTPUT_VARIABLE version)
162 # STRING(REGEX REPLACE "^(Python )([0-9]\\.[0-9])(.*)$" "\\2"
163 # major_minor "${version}")
164 # SET(python_subdir "python${major_minor}/")
165 # ELSE(PYTHON_EXECUTABLE)
166 # SET(python_subdir "python2.4/")
167 # ENDIF(PYTHON_EXECUTABLE)
169 #SET(GDCM_PYTHON_MODULE_DIR_CONFIG
170 # ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_LIB_DIR}/../${python_subdir}site-packages)
172 # The Doxygen options.
173 SET(GDCM_DOXYGEN_DIR_CONFIG
174 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_DOXYGEN_DIR})
177 # If VTK_BINARY_DIR is set, then GDCM is part of a larger parent project
178 # that also builds VTK. In that case, GDCM_VTK_INSTALL_PACKAGE_DIR
179 # should be set to the value of VTK_INSTALL_PACKAGE_DIR. Otherwise, if not set,
180 # then we are using an outside VTK whose location will not change when we
183 IF(NOT GDCM_VTK_INSTALL_PACKAGE_DIR)
186 "GDCM_VTK_INSTALL_PACKAGE_DIR must be set by the parent project to the value of VTK_INSTALL_PACKAGE_DIR it uses to configure VTK.")
187 ENDIF(NOT GDCM_VTK_INSTALL_PACKAGE_DIR)
188 SET(GDCM_VTK_DIR_CONFIG ${GDCM_VTK_INSTALL_PACKAGE_DIR})
190 SET(GDCM_VTK_DIR_CONFIG ${VTK_DIR})
191 ENDIF(VTK_BINARY_DIR)
193 # The build configuration information.
194 # The install tree only has one configuration.
195 SET(GDCM_CONFIGURATION_TYPES_CONFIG)
197 # Configure GDCMConfig.cmake for the install tree.
199 # Construct the proper number of GET_FILENAME_COMPONENT(... PATH)
200 # calls to compute the installation prefix from GDCM_DIR.
201 STRING(REGEX REPLACE "/" ";" GDCM_INSTALL_PACKAGE_DIR_COUNT
202 "${GDCM_INSTALL_PACKAGE_DIR}")
203 SET(GDCM_CONFIG_INSTALL_ONLY "
204 # Compute the installation prefix from GDCM_DIR.
205 SET(GDCM_INSTALL_PREFIX \"${DOLLAR}{GDCM_DIR}\")
207 FOREACH(p ${GDCM_INSTALL_PACKAGE_DIR_COUNT})
208 SET(GDCM_CONFIG_INSTALL_ONLY
209 "${GDCM_CONFIG_INSTALL_ONLY}GET_FILENAME_COMPONENT(GDCM_INSTALL_PREFIX \"${DOLLAR}{GDCM_INSTALL_PREFIX}\" PATH)\n"
213 IF(CMAKE_CONFIGURATION_TYPES)
214 # There are multiple build configurations. Configure one
215 # GDCMConfig.cmake for each configuration.
216 FOREACH(config ${CMAKE_CONFIGURATION_TYPES})
217 SET(GDCM_BUILD_TYPE_CONFIG ${config})
219 ${CMAKE_CURRENT_SOURCE_DIR}/GDCMConfig.cmake.in
220 ${CMAKE_CURRENT_BINARY_DIR}/${config}/GDCMConfig.cmake
224 # Install the config file corresponding to the build configuration
225 # specified when building the install target. The BUILD_TYPE variable
226 # will be set while CMake is processing the install files.
227 IF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
228 INSTALL_FILES(${GDCM_INSTALL_PACKAGE_DIR} FILES
229 ${CMAKE_CURRENT_BINARY_DIR}/${DOLLAR}{BUILD_TYPE}/GDCMConfig.cmake)
230 ENDIF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
231 ELSE(CMAKE_CONFIGURATION_TYPES)
232 # There is only one build configuration. Configure one GDCMConfig.cmake.
233 SET(GDCM_BUILD_TYPE_CONFIG ${CMAKE_BUILD_TYPE})
235 ${CMAKE_CURRENT_SOURCE_DIR}/GDCMConfig.cmake.in
236 ${CMAKE_CURRENT_BINARY_DIR}/GDCMConfig.cmake @ONLY IMMEDIATE)
238 # Setup an install rule for the config file.
239 IF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
240 INSTALL_FILES(${GDCM_INSTALL_PACKAGE_DIR} FILES
241 ${CMAKE_CURRENT_BINARY_DIR}/GDCMConfig.cmake)
242 ENDIF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
243 ENDIF(CMAKE_CONFIGURATION_TYPES)