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 # to be used against non installed library
42 SET(GDCM_LIBRARY_DIRS ${LIBRARY_OUTPUT_PATH})
44 SET(GDCM_LIBRARY_DIRS_CONFIG ${GDCM_LIBRARY_DIRS})
46 # The runtime directories.
47 SET(GDCM_RUNTIME_DIRS_CONFIG ${GDCM_RUNTIME_DIRS})
49 # The include directories.
50 # to be used against non installed library
52 ${GDCM_SOURCE_DIR}/src
53 ${GDCM_SOURCE_DIR}/vtk
56 SET(GDCM_INCLUDE_DIRS_CONFIG ${GDCM_INCLUDE_PATH})
58 # The library dependencies file.
59 SET(GDCM_LIBRARY_DEPENDS_FILE
60 ${GDCM_BINARY_DIR}/GDCMLibraryDepends.cmake)
63 SET(GDCM_DATA_DIR_CONFIG
67 SET(GDCM_EXAMPLES_DIR_CONFIG
71 #SET(GDCM_TEMPLATES_DIR_CONFIG
72 # ${GDCM_TEMPLATES_DIR})
75 #SET(GDCM_RESOURCES_DIR_CONFIG
76 # ${GDCM_RESOURCES_DIR})
78 # The CMake macros dir.
79 SET(GDCM_CMAKE_DIR_CONFIG
83 #SET(GDCM_TCL_PACKAGE_INDEX_DIR_CONFIG ${GDCM_TCL_PACKAGE_INDEX_DIR})
86 SET(GDCM_PYTHON_MODULE_DIR_CONFIG ${GDCM_PYTHON_MODULE_DIR})
88 # The Doxygen options.
89 SET(GDCM_DOXYGEN_DIR_CONFIG ${GDCM_SOURCE_DIR}/Utilities/Doxygen)
92 SET(GDCM_VTK_DIR_CONFIG ${VTK_DIR})
94 # The build configuration information.
95 SET(GDCM_CONFIGURATION_TYPES_CONFIG ${GDCM_CONFIGURATION_TYPES})
96 SET(GDCM_BUILD_TYPE_CONFIG ${CMAKE_BUILD_TYPE})
98 # Configure GDCMConfig.cmake for the build tree.
100 ${CMAKE_CURRENT_SOURCE_DIR}/GDCMConfig.cmake.in
101 ${GDCM_BINARY_DIR}/GDCMConfig.cmake @ONLY IMMEDIATE)
103 #-----------------------------------------------------------------------------
104 # Settings specific to the install tree.
107 SET(GDCM_USE_FILE_CONFIG
108 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_PACKAGE_DIR}/UseGDCM.cmake)
110 # The build settings file.
111 SET(GDCM_BUILD_SETTINGS_FILE_CONFIG
112 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_PACKAGE_DIR}/GDCMBuildSettings.cmake)
114 # The library directories.
115 IF(CYGWIN AND GDCM_BUILD_SHARED_LIBS)
116 # In Cygwin programs directly link to the .dll files.
117 SET(GDCM_LIBRARY_DIRS_CONFIG
118 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_BIN_DIR})
119 ELSE(CYGWIN AND GDCM_BUILD_SHARED_LIBS)
120 SET(GDCM_LIBRARY_DIRS_CONFIG
121 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_LIB_DIR})
122 ENDIF(CYGWIN AND GDCM_BUILD_SHARED_LIBS)
124 # The runtime directories.
126 SET(GDCM_RUNTIME_DIRS_CONFIG
127 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_BIN_DIR})
129 SET(GDCM_RUNTIME_DIRS_CONFIG
130 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_LIB_DIR})
133 # The include directories.
134 SET(GDCM_INCLUDE_DIRS_CONFIG
135 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_INCLUDE_DIR})
137 # The library dependencies file.
138 SET(GDCM_LIBRARY_DEPENDS_FILE
139 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_PACKAGE_DIR}/GDCMLibraryDepends.cmake)
143 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_DATA_DIR}/Data)
146 SET(GDCM_EXAMPLES_DIR_CONFIG
147 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_DATA_DIR}/Examples)
150 #SET(GDCM_TEMPLATES_DIR_CONFIG
151 # ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_INCLUDE_DIR}/Templates)
154 #SET(GDCM_RESOURCES_DIR_CONFIG
155 # ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_DATA_DIR}/Resources)
157 # The CMake macros dir.
158 SET(GDCM_CMAKE_DIR_CONFIG
159 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_PACKAGE_DIR}/CMake)
161 # The Tcl/Tk options.
162 #SET(GDCM_TCL_PACKAGE_INDEX_DIR_CONFIG
163 # ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_LIB_DIR}/tcl)
165 # The Python options.
167 # SET(python_subdir "")
169 # IF(PYTHON_EXECUTABLE)
170 # EXEC_PROGRAM("${PYTHON_EXECUTABLE}" ARGS "-V" OUTPUT_VARIABLE version)
171 # STRING(REGEX REPLACE "^(Python )([0-9]\\.[0-9])(.*)$" "\\2"
172 # major_minor "${version}")
173 # SET(python_subdir "python${major_minor}/")
174 # ELSE(PYTHON_EXECUTABLE)
175 # SET(python_subdir "python2.5/")
176 # ENDIF(PYTHON_EXECUTABLE)
178 #SET(GDCM_PYTHON_MODULE_DIR_CONFIG
179 # ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_LIB_DIR}/../${python_subdir}site-packages)
181 # The Doxygen options.
182 SET(GDCM_DOXYGEN_DIR_CONFIG
183 ${DOLLAR}{GDCM_INSTALL_PREFIX}${GDCM_INSTALL_DOXYGEN_DIR})
186 # If VTK_BINARY_DIR is set, then GDCM is part of a larger parent project
187 # that also builds VTK. In that case, GDCM_VTK_INSTALL_PACKAGE_DIR
188 # should be set to the value of VTK_INSTALL_PACKAGE_DIR. Otherwise, if not set,
189 # then we are using an outside VTK whose location will not change when we
192 IF(NOT GDCM_VTK_INSTALL_PACKAGE_DIR)
195 "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.")
196 ENDIF(NOT GDCM_VTK_INSTALL_PACKAGE_DIR)
197 SET(GDCM_VTK_DIR_CONFIG ${GDCM_VTK_INSTALL_PACKAGE_DIR})
199 SET(GDCM_VTK_DIR_CONFIG ${VTK_DIR})
200 ENDIF(VTK_BINARY_DIR)
202 # The build configuration information.
203 # The install tree only has one configuration.
204 SET(GDCM_CONFIGURATION_TYPES_CONFIG)
206 # Configure GDCMConfig.cmake for the install tree.
208 # Construct the proper number of GET_FILENAME_COMPONENT(... PATH)
209 # calls to compute the installation prefix from GDCM_DIR.
210 STRING(REGEX REPLACE "/" ";" GDCM_INSTALL_PACKAGE_DIR_COUNT
211 "${GDCM_INSTALL_PACKAGE_DIR}")
212 SET(GDCM_CONFIG_INSTALL_ONLY "
213 # Compute the installation prefix from GDCM_DIR.
214 SET(GDCM_INSTALL_PREFIX \"${DOLLAR}{GDCM_DIR}\")
216 FOREACH(p ${GDCM_INSTALL_PACKAGE_DIR_COUNT})
217 SET(GDCM_CONFIG_INSTALL_ONLY
218 "${GDCM_CONFIG_INSTALL_ONLY}GET_FILENAME_COMPONENT(GDCM_INSTALL_PREFIX \"${DOLLAR}{GDCM_INSTALL_PREFIX}\" PATH)\n"
222 IF(CMAKE_CONFIGURATION_TYPES)
223 # There are multiple build configurations. Configure one
224 # GDCMConfig.cmake for each configuration.
225 FOREACH(config ${CMAKE_CONFIGURATION_TYPES})
226 SET(GDCM_BUILD_TYPE_CONFIG ${config})
228 ${CMAKE_CURRENT_SOURCE_DIR}/GDCMConfig.cmake.in
229 ${CMAKE_CURRENT_BINARY_DIR}/${config}/GDCMConfig.cmake
233 # Install the config file corresponding to the build configuration
234 # specified when building the install target. The BUILD_TYPE variable
235 # will be set while CMake is processing the install files.
236 IF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
237 INSTALL_FILES(${GDCM_INSTALL_PACKAGE_DIR} FILES
238 ${CMAKE_CURRENT_BINARY_DIR}/${DOLLAR}{BUILD_TYPE}/GDCMConfig.cmake)
239 ENDIF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
240 ELSE(CMAKE_CONFIGURATION_TYPES)
241 # There is only one build configuration. Configure one GDCMConfig.cmake.
242 SET(GDCM_BUILD_TYPE_CONFIG ${CMAKE_BUILD_TYPE})
244 ${CMAKE_CURRENT_SOURCE_DIR}/GDCMConfig.cmake.in
245 ${CMAKE_CURRENT_BINARY_DIR}/GDCMConfig.cmake @ONLY IMMEDIATE)
247 # Setup an install rule for the config file.
248 IF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
249 INSTALL_FILES(${GDCM_INSTALL_PACKAGE_DIR} FILES
250 ${CMAKE_CURRENT_BINARY_DIR}/GDCMConfig.cmake)
251 ENDIF(NOT GDCM_INSTALL_NO_DEVELOPMENT)
252 ENDIF(CMAKE_CONFIGURATION_TYPES)