1 # ============================================================================== 2 # Medical Image Registration ToolKit (MIRTK) 4 # Copyright 2013-2016 Imperial College London 5 # Copyright 2013-2016 Andreas Schuh 7 # Licensed under the Apache License, Version 2.0 (the "License"); 8 # you may not use this file except in compliance with the License. 9 # You may obtain a copy of the License at 11 # http://www.apache.org/licenses/LICENSE-2.0 13 # Unless required by applicable law or agreed to in writing, software 14 # distributed under the License is distributed on an "AS IS" BASIS, 15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 # See the License for the specific language governing permissions and 17 # limitations under the License. 18 # ============================================================================== 20 ############################################################################## 21 # @file MIRTKConfig.cmake 22 # @brief CMake package configuration file. 24 # @note The MIRTKConfig.cmake file is automatically generated 25 # by BASIS from the template file Config.cmake.in which is part of 28 # Variables in this file have to be prefixed by the name of this package. 29 # In the default package configuration file of BASIS, which can be included 30 # here using the \@BASIS_CONFIG\@ variable, this prefix is defined as @c NS 31 # variable. Moreover, the macro basis_set_config() should be used for 32 # convenience to set any configuration variable, e.g., 35 # basis_set_config (INCLUDE_DIR "\@INCLUDE_DIR_CONFIG\@") 38 # where the variable @c INCLUDE_DIR_CONFIG is set in the ConfigSettings.cmake 39 # file of the BASIS installation. Note that this statement will set the 40 # variable ${NS}INCLUDE_DIR, where by default @c NS is the package name 41 # followed by an underscore (_). 43 # See the Config.cmake.in file of BASIS for details. 45 # @ingroup BasisConfig 46 ############################################################################## 48 ## @addtogroup BasisConfig 51 # ============================================================================ 52 # List of requested modules 53 # ============================================================================ 55 if (MIRTK_FIND_COMPONENTS)
56 set(MIRTK_MODULES_REQUESTED
"${MIRTK_FIND_COMPONENTS}")
57 foreach (_CMP IN ITEMS BASIS CMake)
58 list(FIND MIRTK_MODULES_REQUESTED ${_CMP} _IDX)
60 set(_INCLUDE_${_CMP}_MODULES FALSE)
62 list(REMOVE_ITEM MIRTK_MODULES_REQUESTED ${_CMP})
63 set(_INCLUDE_${_CMP}_MODULES TRUE)
71 # ============================================================================ 73 # ============================================================================ 75 # prefix used for variable names 78 # allow caller to change
namespace - used by projects with modules
79 if (${NS}CONFIG_PREFIX)
80 set (NS
"${${NS}CONFIG_PREFIX}_")
83 # ---------------------------------------------------------------------------- 84 macro (basis_set_config NAME)
85 set (${NS}${NAME} ${ARGN})
88 # ---------------------------------------------------------------------------- 89 macro (basis_copy_config NAME SRC)
90 set (${NS}${NAME} ${${NS}${SRC}})
93 # ---------------------------------------------------------------------------- 94 macro (basis_append_config NAME)
95 list (APPEND ${NS}${NAME} ${ARGN})
98 # ---------------------------------------------------------------------------- 99 macro (basis_find_config NAME VALUE IDX)
100 list (FIND ${NS}${NAME}
"${VALUE}" ${IDX})
103 # ---------------------------------------------------------------------------- 104 macro (basis_remove_duplicates_config NAME)
106 list (REMOVE_DUPLICATES ${NS}${NAME})
110 # ---------------------------------------------------------------------------- 111 macro (basis_remove_item_config NAME ITEM)
113 list (REMOVE_ITEM ${NS}${NAME}
"${ITEM}")
117 # ---------------------------------------------------------------------------- 118 if (NOT COMMAND basis_is_cached)
119 macro (basis_is_cached VAR ENTRY)
120 if (DEFINED ${ENTRY})
121 get_property (${VAR} CACHE ${ENTRY} PROPERTY TYPE SET)
128 # ---------------------------------------------------------------------------- 129 if (NOT COMMAND basis_set_or_update_value)
130 macro (basis_set_or_update_value VAR)
131 basis_is_cached (_CACHED ${VAR})
133 if (${ARGC} GREATER 1)
134 set_property (CACHE ${VAR} PROPERTY VALUE ${ARGN})
136 set (${VAR}
"" CACHE INTERNAL
"" FORCE)
145 # ============================================================================ 147 # ============================================================================ 149 ## @brief Installation prefix or root of build tree. 150 basis_set_config (INSTALL_PREFIX
"/Users/as12312/Software/MIRTK/Maintenance/Build/Clang_x86_64/Release")
151 get_filename_component (${NS}INSTALL_PREFIX
"${${NS}INSTALL_PREFIX}" ABSOLUTE)
153 ## @brief Project use file to be included by other projects.
154 basis_set_config (USE_FILE
"${CMAKE_CURRENT_LIST_DIR}/MIRTKUse.cmake")
156 ## @brief Directory of example files. 157 basis_set_config (EXAMPLE_DIR
"")
159 # ============================================================================ 161 # ============================================================================ 163 ## @brief Directory of header files. 164 basis_set_config (INCLUDE_DIR
"/Users/as12312/Software/MIRTK/Maintenance/Build/Clang_x86_64/Release/include;/Users/as12312/Software/MIRTK/Maintenance/include")
166 ## @brief Directory of header files including dependencies. 167 basis_set_config (INCLUDE_DIRS)
# to have a set recognized by Doxygen filter 168 basis_copy_config (INCLUDE_DIRS INCLUDE_DIR)
169 basis_append_config (INCLUDE_DIRS
"")
171 ## @brief Directory of libraries. 172 basis_set_config (LIBRARY_DIR
"/Users/as12312/Software/MIRTK/Maintenance/Build/Clang_x86_64/Release/lib")
174 ## @brief Directory of libraries including dependencies. 175 basis_set_config (LIBRARY_DIRS)
# to have a set() recognized by Doxygen filter 176 basis_copy_config (LIBRARY_DIRS LIBRARY_DIR)
177 basis_append_config (LIBRARY_DIRS
"")
179 ## @brief Search path for Python modules. 180 basis_set_config (PYTHONPATH
"/Users/as12312/Software/MIRTK/Maintenance/Build/Clang_x86_64/Release/lib/python")
182 ## @brief Search path for Jython modules. 183 basis_set_config (JYTHONPATH
"/Users/as12312/Software/MIRTK/Maintenance/Build/Clang_x86_64/Release/lib/jython")
185 ## @brief Search path for Perl modules. 186 basis_set_config (PERL5LIB
"/Users/as12312/Software/MIRTK/Maintenance/Build/Clang_x86_64/Release/lib/perl")
188 ## @brief Search path for MATLAB modules. 189 basis_set_config (MATLABPATH
"/Users/as12312/Software/MIRTK/Maintenance/Build/Clang_x86_64/Release/lib/matlab")
191 ## @brief Search path for Bash modules. 193 # See the import() function of the BASIS Bash utilities. 194 basis_set_config (BASHPATH
"/Users/as12312/Software/MIRTK/Maintenance/Build/Clang_x86_64/Release/lib/bash")
196 # ============================================================================ 198 # ============================================================================ 200 ## @brief Absolute path of exports file to be included by other projects. 201 basis_set_config (EXPORTS_FILE
"${CMAKE_CURRENT_LIST_DIR}/MIRTKTargets.cmake")
203 ## @brief Absolute path of custom exports file to be included by other projects. 204 basis_set_config (CUSTOM_EXPORTS_FILE
"${CMAKE_CURRENT_LIST_DIR}/MIRTKCustomTargets.cmake")
206 # ============================================================================ 208 # ============================================================================ 210 ## @brief Directory containing module configuration files 211 basis_set_config (MODULES_DIR
"/Users/as12312/Software/MIRTK/Maintenance/Build/Clang_x86_64/Release/lib/cmake/mirtk")
213 ## @brief List of known project modules. 214 basis_set_config (MODULES
"Common;IO;Image;Numerics;PointSet;Registration;Transformation;Deformable;Mapping;DrawEM;Scripting;Applications")
216 ## @brief List of found requested modules. 217 basis_set_config (MODULES_FOUND)
219 ## @brief List of not found optional modules. 220 basis_set_config (MODULES_NOTFOUND)
222 ## @brief List of available project modules. 223 basis_set_config (MODULES_ENABLED)
224 file (GLOB _CONFIG_FILES "${${NS}MODULES_DIR}/MIRTK*Config.cmake
") 225 foreach (_CONFIG_FILE IN LISTS _CONFIG_FILES) 226 if (_CONFIG_FILE MATCHES "/MIRTK([^ /][^ /]*)Config.cmake")
227 set (_MODULE_NAME ${CMAKE_MATCH_1})
228 basis_append_config (MODULES ${_MODULE_NAME})
229 basis_append_config (MODULES_ENABLED ${_MODULE_NAME})
233 basis_remove_duplicates_config (MODULES)
234 basis_remove_duplicates_config (MODULES_ENABLED)
236 unset (_CONFIG_FILES)
239 ## @brief List of modules requested by external package using the 240 # @c COMPONENTS argument of 241 # <a href="http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_package"> 242 # find_package()</a>. 243 if (NOT DEFINED ${NS}MODULES_REQUESTED)
244 if (${NS}FIND_COMPONENTS)
245 basis_copy_config (MODULES_REQUESTED FIND_COMPONENTS)
247 if (NOT ${NS}MODULES_REQUESTED)
248 basis_copy_config (MODULES_REQUESTED MODULES_ENABLED)
251 basis_remove_duplicates_config (MODULES_REQUESTED)
253 set (_PACKAGE_NS "${NS}
") 254 foreach (_MODULE_NAME IN LISTS ${NS}MODULES_REQUESTED) 255 # check if requested module is available 256 basis_find_config (MODULES_ENABLED ${_MODULE_NAME} _MODULE_IDX) 257 if (_MODULE_IDX EQUAL -1) 258 # set <Pkg>_<Module>_FOUND = FALSE 259 basis_set_config (${_MODULE_NAME}_FOUND FALSE) 260 # append to list of not found requested modules 261 basis_append_config (MODULES_NOTFOUND ${_MODULE_NAME}) 263 set (_MODULE_NS "${NS}${_MODULE_NAME}_
") 264 # include configuration file of module 265 set (${_MODULE_NAME}_CONFIG_PREFIX "${_MODULE_NS}
") 266 include ("${${NS}MODULES_DIR}/MIRTK${_MODULE_NAME}Config.cmake
") 267 unset (${_MODULE_NAME}_CONFIG_PREFIX) 268 set (NS "${_PACKAGE_NS}
") # restore NS of this package config 269 # append include directories 270 if (${_MODULE_NS}INCLUDE_DIRS) 271 basis_append_config (INCLUDE_DIRS ${${_MODULE_NS}INCLUDE_DIRS}) 272 elseif (${_MODULE_NS}INCLUDE_DIR) 273 basis_append_config (INCLUDE_DIRS ${${_MODULE_NS}INCLUDE_DIR}) 275 # append library directories 276 if (${_MODULE_NS}LIBRARY_DIRS) 277 basis_append_config (LIBRARY_DIRS ${${_MODULE_NS}LIBRARY_DIRS}) 278 elseif (${_MODULE_NS}LIBARY_DIR) 279 basis_append_config (LIBRARY_DIRS ${${_MODULE_NS}LIBRARY_DIR}) 281 # set <Pkg>_<Module>_FOUND = TRUE 282 basis_set_config (${_MODULE_NAME}_FOUND TRUE) 283 # append to list of found requested modules 284 basis_append_config (MODULES_FOUND ${_MODULE_NAME}) 289 if (${NS}MODULES_NOTFOUND) 293 foreach (_MODULE_NAME IN LISTS ${NS}MODULES_REQUESTED) 294 if (${NS}FIND_REQUIRED_${_MODULE_NAME}) 295 list (APPEND _REQUIRED ${_MODULE_NAME}) 296 if (NOT ${NS}${_MODULE_NAME}_FOUND) 297 list (APPEND _MISSING ${_MODULE_NAME}) 300 list (APPEND _OPTIONAL ${_MODULE_NAME}) 304 message(FATAL_ERROR "Could not find all required MIRTK components!
" 305 " Rebuild and/or install the MIRTK
package with"
306 " the following modules enabled by setting MODULE_<name>"
307 " to ON when configuring the build of the package with CMake."
308 "\nOptional modules = [${_OPTIONAL}]"
309 "\nRequired modules = [${_REQUIRED}]"
310 "\nMissing modules = [${_MISSING}]\n")
321 # ============================================================================
322 # clean INCLUDE_DIRS and LIBRARY_DIRS
323 # ============================================================================
325 basis_remove_duplicates_config (INCLUDE_DIR)
326 basis_remove_duplicates_config (INCLUDE_DIRS)
327 basis_remove_duplicates_config (LIBRARY_DIR)
328 basis_remove_duplicates_config (LIBRARY_DIRS)
330 basis_remove_item_config (INCLUDE_DIRS "")
331 basis_remove_item_config (LIBRARY_DIRS "")
333 # ============================================================================
335 # ============================================================================
339 # ============================================================================
341 # ============================================================================
343 ## @brief Directory containing the CMake BASIS Modules
344 set(BASIS_MODULE_PATH "/Users/as12312/Software/MIRTK/Maintenance/CMake/Basis")
346 if (EXISTS "${BASIS_MODULE_PATH}/BasisTools.cmake")
347 set(MIRTK_BASIS_FOUND TRUE)
349 set(MIRTK_BASIS_FOUND FALSE)
351 if (NOT MIRTK_BASIS_FOUND AND (MIRTK_FIND_REQUIRED_BASIS OR MIRTK_FIND_REQUIRED_CMake))
352 message (FATAL_ERROR "Required CMake BASIS Modules of package MIRTK"
353 " could not be found in ${BASIS_MODULE_PATH}!")
356 ## @brief Directory containing the MIRTK CMake Modules
357 set(MIRTK_MODULE_PATH "/Users/as12312/Software/MIRTK/Maintenance/CMake/Modules")
359 if (EXISTS "${MIRTK_MODULE_PATH}/mirtkTools.cmake")
360 set(MIRTK_CMake_FOUND TRUE)
362 set(MIRTK_CMake_FOUND FALSE)
364 if (NOT MIRTK_CMake_FOUND AND MIRTK_FIND_REQUIRED_CMake)
365 message (FATAL_ERROR "Required CMake Modules of package MIRTK"
366 " could not be found in ${MIRTK_MODULE_PATH}!")
368 if (NOT MIRTK_BASIS_FOUND)
369 set(MIRTK_CMake_FOUND FALSE)
372 # include requested CMake modules
373 if (_INCLUDE_BASIS_MODULES OR _INCLUDE_CMake_MODULES)
374 if (MIRTK_CMake_FOUND)
375 list(APPEND CMAKE_MODULE_PATH "${MIRTK_MODULE_PATH}")
377 if (MIRTK_BASIS_FOUND)
378 list(APPEND CMAKE_MODULE_PATH "${BASIS_MODULE_PATH}")
380 if (_INCLUDE_CMake_MODULES AND MIRTK_CMake_FOUND)
381 include(mirtkPolicies NO_POLICY_SCOPE)
383 if (MIRTK_BASIS_FOUND)
384 include(BasisSettings)
387 if (_INCLUDE_CMake_MODULES AND MIRTK_CMake_FOUND)
392 unset(_INCLUDE_BASIS_MODULES)
393 unset(_INCLUDE_CMake_MODULES)
395 # ============================================================================
397 # ============================================================================
399 ## @brief Directory containing the MIRTK command executables
400 set(MIRTK_TOOLS_DIR "")
402 ## @brief Whether to build shared libraries by default
403 if (NOT DEFINED BUILD_SHARED_LIBS_DEFAULT)
404 set(BUILD_SHARED_LIBS_DEFAULT ON)
407 ## @brief Whether to enable profiling of code execution by default
408 if (NOT DEFINED WITH_PROFILING_DEFAULT)
409 set(WITH_PROFILING_DEFAULT ON)
412 ## @brief Whether to build applications by default
413 if (NOT DEFINED BUILD_APPLICATIONS_DEFAULT)
414 set(BUILD_APPLICATIONS_DEFAULT ON)
417 ## @brief Default for WITH_TBB
418 if (NOT DEFINED WITH_TBB_DEFAULT)
419 set(WITH_TBB_DEFAULT ON)
422 ## @brief Default for WITH_VTK
423 if (NOT DEFINED WITH_VTK_DEFAULT)
424 set(WITH_VTK_DEFAULT ON)
427 ## @brief Default for WITH_ZLIB
428 if (NOT DEFINED WITH_ZLIB_DEFAULT)
429 set(WITH_ZLIB_DEFAULT ON)
434 # end of Doxygen group - keep at end of file