1 ################################################################## 5 #! Creates a module for the automatic module dependency system within MITK. 10 #! mitk_create_module( 11 #! DEPENDS PUBLIC MitkCore 13 #! PRIVATE Qt5|Xml+Networking 14 #! PUBLIC ITK|Watershed 17 #! The <moduleName> parameter specifies the name of the module which is used 18 #! to create a logical target name. The parameter is optional in case the 19 #! MITK_MODULE_NAME_DEFAULTS_TO_DIRECTORY_NAME variable evaluates to TRUE. The 20 #! module name will then be derived from the directory name in which this 21 #! function is called. 23 #! If set, the following variables will be used to validate the module name: 25 #! MITK_MODULE_NAME_REGEX_MATCH The module name must match this regular expression. 26 #! MITK_MODULE_NAME_REGEX_NOT_MATCH The module name must not match this regular expression. 28 #! If the MITK_MODULE_NAME_PREFIX variable is set, the module name will be prefixed 31 #! A modules source files are specified in a separate CMake file usually 32 #! called files.cmake, located in the module root directory. The 33 #! mitk_create_module() macro evaluates the following CMake variables 34 #! from the files.cmake file: 36 #! - CPP_FILES A list of .cpp files 37 #! - H_FILES A list of .h files without a corresponding .cpp file 38 #! - TXX_FILES A list of .txx files 39 #! - RESOURCE_FILES A list of files (resources) which are embedded into the module 40 #! - MOC_H_FILES A list of Qt header files which should be processed by the MOC 41 #! - UI_FILES A list of .ui Qt UI files 42 #! - QRC_FILES A list of .qrc Qt resource files 43 #! - DOX_FILES A list of .dox Doxygen files 45 #! List of variables available after the function is called: 48 #! - MODULE_IS_ENABLED 49 #! - MODULE_SUBPROJECTS 51 #! \sa mitk_create_executable 53 #! Parameters (all optional): 55 #! \param <moduleName> The module name (also used as target name) 56 #! \param FILES_CMAKE File name of a CMake file setting source list variables 57 #! (defaults to files.cmake) 58 #! \param VERSION Module version number, e.g. "1.2.0" 59 #! \param AUTOLOAD_WITH A module target name identifying the module which will 60 #! trigger the automatic loading of this module 61 #! \param DEPRECATED_SINCE Marks this modules as deprecated since <arg> 62 #! \param DESCRIPTION A description for this module 64 #! Multi-value Parameters (all optional): 67 #! \param SUBPROJECTS List of CDash labels 68 #! \param INCLUDE_DIRS Include directories for this module: 70 #! [[PUBLIC|PRIVATE|INTERFACE] <dir1>...]... 72 #! The default scope for include directories is PUBLIC. 73 #! \param DEPENDS List of module dependencies: 75 #! [[PUBLIC|PRIVATE|INTERFACE] <module1>...]... 77 #! The default scope for module dependencies is PUBLIC. 78 #! \param PACKAGE_DEPENDS List of public packages dependencies (e.g. Qt, VTK, etc.). 79 #! Package dependencies have the following syntax: 81 #! [PUBLIC|PRIVATE|INTERFACE] PACKAGE[|COMPONENT1[+COMPONENT2]...] 83 #! The default scope for package dependencies is PRIVATE. 84 #! \param ADDITIONAL_LIBS List of additional private libraries linked to this module. 85 #! The folder containing the library will be added to the global list of library search paths. 86 #! \param CPP_FILES List of source files for this module. If the list is non-empty, 87 #! the module does not need to provide a files.cmake file or FILES_CMAKE argument. 88 #! \param H_FILES List of public header files for this module. It is recommended to use 89 #! a files.cmake file instead. 93 #! \param FORCE_STATIC Force building this module as a static library 94 #! \param GCC_DEFAULT_VISIBILITY Do not use gcc visibility flags - all 95 #! symbols will be exported 96 #! \param NO_INIT Do not create CppMicroServices initialization code 97 #! \param NO_FEATURE_INFO Do not create a feature info by calling add_feature_info() 98 #! \param WARNINGS_NO_ERRORS Do not treat compiler warnings as errors 100 ################################################################## 104 VERSION # module version number, e.g.
"1.2.0" 105 EXPORT_DEFINE # export macro name
for public symbols of
this module (
DEPRECATED)
106 AUTOLOAD_WITH # a module target name identifying the module which will trigger the
107 # automatic loading of this module 108 FILES_CMAKE # file name of a
CMake file setting source list variables
109 # (defaults to files.cmake) 110 DEPRECATED_SINCE # marks
this modules as deprecated
111 DESCRIPTION # a description
for this module
114 set(_macro_multiparams
115 SUBPROJECTS # list of CDash labels
116 INCLUDE_DIRS # include directories: [PUBLIC|PRIVATE|INTERFACE] <list>
117 INTERNAL_INCLUDE_DIRS # include dirs
internal to
this module (
DEPRECATED)
118 DEPENDS # list of modules
this module depends on: [PUBLIC|PRIVATE|INTERFACE] <list>
119 DEPENDS_INTERNAL # list of modules
this module internally depends on (
DEPRECATED)
120 PACKAGE_DEPENDS # list of
"packages this module depends on (e.g. Qt, VTK, etc.): [PUBLIC|PRIVATE|INTERFACE] <package-list> 121 TARGET_DEPENDS # list of CMake targets this module should depend on 122 ADDITIONAL_LIBS # list of addidtional private libraries linked to this module. 123 CPP_FILES # list of cpp files 124 H_FILES # list of header files: [PUBLIC|PRIVATE] <list> 128 FORCE_STATIC # force building this module as a static library 129 HEADERS_ONLY # this module is a headers-only library 130 GCC_DEFAULT_VISIBILITY # do not use gcc visibility flags - all symbols will be exported 131 NO_DEFAULT_INCLUDE_DIRS # do not add default include directories like "include
" or ".
" 132 NO_INIT # do not create CppMicroServices initialization code 133 NO_FEATURE_INFO # do not create a feature info by calling add_feature_info() 134 WARNINGS_NO_ERRORS # do not treat compiler warnings as errors 135 EXECUTABLE # create an executable; do not use directly, use mitk_create_executable() instead 136 C_MODULE # compile all source files as C sources 137 CXX_MODULE # compile all source files as C++ sources 140 cmake_parse_arguments(MODULE "${_macro_options}
" "${_macro_params}
" "${_macro_multiparams}
" ${ARGN}) 142 set(MODULE_NAME ${MODULE_UNPARSED_ARGUMENTS}) 144 # ----------------------------------------------------------------- 148 if(MITK_MODULE_NAME_DEFAULTS_TO_DIRECTORY_NAME) 149 get_filename_component(MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 151 message(SEND_ERROR "The module name must not be empty
") 155 set(_deprecated_args INTERNAL_INCLUDE_DIRS DEPENDS_INTERNAL EXPORT_DEFINE TARGET_DEPENDS HEADERS_ONLY) 156 foreach(_deprecated_arg ${_deprecated_args}) 157 if(MODULE_${_deprecated_arg}) 158 message(WARNING "The ${_deprecated_arg} argument is deprecated
") 162 set(_module_type module) 163 set(_Module_type Module) 164 if(MODULE_EXECUTABLE) 165 set(_module_type executable) 166 set(_Module_type Executable) 169 if(MITK_MODULE_NAME_REGEX_MATCH) 170 if(NOT ${MODULE_NAME} MATCHES ${MITK_MODULE_NAME_REGEX_MATCH}) 171 message(SEND_ERROR "The ${_module_type} name \
"${MODULE_NAME}\" does not match the regular expression \"${MITK_MODULE_NAME_REGEX_MATCH}\".")
174 if(MITK_MODULE_NAME_REGEX_NOT_MATCH)
175 if(${MODULE_NAME} MATCHES ${MITK_MODULE_NAME_REGEX_NOT_MATCH})
176 message(SEND_ERROR
"The ${_module_type} name \"${MODULE_NAME}\" must not match the regular expression \"${MITK_MODULE_NAME_REGEX_NOT_MATCH}\".")
180 if(MITK_MODULE_NAME_PREFIX AND NOT MODULE_NAME MATCHES "^${MITK_MODULE_NAME_PREFIX}.*$
") 181 set(MODULE_NAME "${MITK_MODULE_NAME_PREFIX}${MODULE_NAME}
") 184 if(NOT MODULE_FILES_CMAKE) 185 set(MODULE_FILES_CMAKE files.cmake) 187 if(NOT IS_ABSOLUTE ${MODULE_FILES_CMAKE}) 188 set(MODULE_FILES_CMAKE ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_FILES_CMAKE}) 191 if(NOT MODULE_SUBPROJECTS) 192 if(MITK_DEFAULT_SUBPROJECTS) 193 set(MODULE_SUBPROJECTS ${MITK_DEFAULT_SUBPROJECTS}) 194 elseif(TARGET MITK-Modules) 195 set(MODULE_SUBPROJECTS MITK-Modules) 199 # check if the subprojects exist as targets 200 if(MODULE_SUBPROJECTS) 201 foreach(subproject ${MODULE_SUBPROJECTS}) 202 if(NOT TARGET ${subproject}) 203 message(SEND_ERROR "The subproject ${subproject} does not have a corresponding target
") 208 # ----------------------------------------------------------------- 209 # Check if module should be build 211 set(MODULE_TARGET ${MODULE_NAME}) 214 set(MODULE_IS_ENABLED 0) 215 # first we check if we have an explicit module build list 216 if(MITK_MODULES_TO_BUILD) 217 list(FIND MITK_MODULES_TO_BUILD ${MODULE_NAME} _MOD_INDEX) 218 if(_MOD_INDEX EQUAL -1) 219 set(MODULE_IS_EXCLUDED 1) 223 if(NOT MODULE_IS_EXCLUDED) 224 # first of all we check for the dependencies 225 _mitk_parse_package_args(${MODULE_PACKAGE_DEPENDS}) 226 mitk_check_module_dependencies(MODULES ${MODULE_DEPENDS} 227 PACKAGES ${PACKAGE_NAMES} 228 MISSING_DEPENDENCIES_VAR _MISSING_DEP 229 PACKAGE_DEPENDENCIES_VAR PACKAGE_NAMES) 232 if(MODULE_NO_FEATURE_INFO) 233 message("${_Module_type} ${MODULE_NAME} won
't be built, missing dependency: ${_MISSING_DEP}") 235 set(MODULE_IS_ENABLED 0) 237 foreach(dep ${MODULE_DEPENDS}) 239 get_target_property(AUTLOAD_DEP ${dep} MITK_AUTOLOAD_DIRECTORY) 241 message(SEND_ERROR "Module \"${MODULE_NAME}\" has an invalid dependency on autoload module \"${dep}\". Check MITK_CREATE_MODULE usage for \"${MODULE_NAME}\".") 246 set(MODULE_IS_ENABLED 1) 247 # now check for every package if it is enabled. This overlaps a bit with 248 # MITK_CHECK_MODULE ... 249 foreach(_package ${PACKAGE_NAMES}) 250 if((DEFINED MITK_USE_${_package}) AND NOT (MITK_USE_${_package})) 251 message("${_Module_type} ${MODULE_NAME} won't be built. Turn on MITK_USE_${_package}
if you want to use it.
") 252 set(MODULE_IS_ENABLED 0) 259 # ----------------------------------------------------------------- 260 # Start creating the module 262 if(MODULE_IS_ENABLED) 264 # clear variables defined in files.cmake 274 # clear other variables 275 set(Q${KITNAME}_GENERATED_CPP ) 276 set(Q${KITNAME}_GENERATED_MOC_CPP ) 277 set(Q${KITNAME}_GENERATED_QRC_CPP ) 278 set(Q${KITNAME}_GENERATED_UI_CPP ) 280 # check and set-up auto-loading 281 if(MODULE_AUTOLOAD_WITH) 282 if(NOT TARGET "${MODULE_AUTOLOAD_WITH}
") 283 message(SEND_ERROR "The module target \
"${MODULE_AUTOLOAD_WITH}\" specified as the auto-loading module for \"${MODULE_NAME}\" does not exist")
286 set(_module_autoload_meta_target "${CMAKE_PROJECT_NAME}-autoload
") 287 # create a meta-target if it does not already exist 288 if(NOT TARGET ${_module_autoload_meta_target}) 289 add_custom_target(${_module_autoload_meta_target}) 290 set_property(TARGET ${_module_autoload_meta_target} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Modules/Autoload
") 293 if(NOT MODULE_EXPORT_DEFINE) 294 set(MODULE_EXPORT_DEFINE ${MODULE_NAME}_EXPORT) 297 if(MITK_GENERATE_MODULE_DOT) 298 message("MODULEDOTNAME ${MODULE_NAME}
") 299 foreach(dep ${MODULE_DEPENDS}) 300 message("MODULEDOT \
"${MODULE_NAME}\" -> \"${dep}\" ; ")
302 endif(MITK_GENERATE_MODULE_DOT)
304 if (EXISTS ${MODULE_FILES_CMAKE})
305 include(${MODULE_FILES_CMAKE})
309 list(APPEND CPP_FILES ${MODULE_CPP_FILES})
312 if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src
") 313 # Preprend the "src
" directory to the cpp file list 314 set(_cpp_files ${CPP_FILES}) 316 foreach(_cpp_file ${_cpp_files}) 317 list(APPEND CPP_FILES "src/${_cpp_file}
") 321 if(CPP_FILES OR RESOURCE_FILES OR UI_FILES OR MOC_H_FILES OR QRC_FILES) 322 set(MODULE_HEADERS_ONLY 0) 324 set_source_files_properties(${CPP_FILES} PROPERTIES LANGUAGE C) 325 elseif(MODULE_CXX_MODULE) 326 set_source_files_properties(${CPP_FILES} PROPERTIES LANGUAGE CXX) 329 set(MODULE_HEADERS_ONLY 1) 330 if(MODULE_AUTOLOAD_WITH) 331 message(SEND_ERROR "A headers only module cannot be
auto-loaded
") 336 set(module_c_flags_debug ) 337 set(module_c_flags_release ) 338 set(module_cxx_flags ) 339 set(module_cxx_flags_debug ) 340 set(module_cxx_flags_release ) 342 if(MODULE_GCC_DEFAULT_VISIBILITY OR NOT CMAKE_COMPILER_IS_GNUCXX) 343 # We only support hidden visibility for gcc for now. Clang still has troubles with 344 # correctly marking template declarations and explicit template instantiations as exported. 345 # See http://comments.gmane.org/gmane.comp.compilers.clang.scm/50028 346 # and http://llvm.org/bugs/show_bug.cgi?id=10113 347 set(CMAKE_CXX_VISIBILITY_PRESET default) 348 set(CMAKE_VISIBILITY_INLINES_HIDDEN 0) 350 set(CMAKE_CXX_VISIBILITY_PRESET hidden) 351 set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) 354 if(NOT MODULE_WARNINGS_NO_ERRORS) 356 mitkFunctionCheckCAndCXXCompilerFlags("/WX
" module_c_flags module_cxx_flags) 357 # this would turn on unused parameter warnings, but unfortunately MSVC cannot 358 # distinguish yet between internal and external headers so this would be triggered 359 # a lot by external code. There is support for it on the way so this line could be 360 # reactivated after https://gitlab.kitware.com/cmake/cmake/issues/17904 has been fixed. 361 # mitkFunctionCheckCAndCXXCompilerFlags("/w34100
" module_c_flags module_cxx_flags) 363 mitkFunctionCheckCAndCXXCompilerFlags(-Werror module_c_flags module_cxx_flags) 365 # The flag "c++0x-
static-nonintegral-init
" has been renamed in newer Clang 366 # versions to "static-member-init
", see 367 # http://clang-developers.42468.n3.nabble.com/Wc-0x-static-nonintegral-init-gone-td3999651.html 369 # Also, older Clang and seemingly all gcc versions do not warn if unknown 370 # "-no-*
" flags are used, so CMake will happily append any -Wno-* flag to the 371 # command line. This may get confusing if unrelated compiler errors happen and 372 # the error output then additionally contains errors about unknown flags (which 373 # is not the case if there were no compile errors). 375 # So instead of using -Wno-* we use -Wno-error=*, which will be properly rejected by 376 # the compiler and if applicable, prints the specific warning as a real warning and 377 # not as an error (although -Werror was given). 379 mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=c++0x-
static-nonintegral-init
" module_c_flags module_cxx_flags) 380 mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=
static-member-init
" module_c_flags module_cxx_flags) 381 mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=
unknown-warning
" module_c_flags module_cxx_flags) 382 mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=gnu
" module_c_flags module_cxx_flags) 383 mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=
class-memaccess
" module_c_flags module_cxx_flags) 384 mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=inconsistent-missing-
override" module_c_flags module_cxx_flags) 385 mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=deprecated-copy
" module_c_flags module_cxx_flags) 386 mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=cast-
function-type
" module_c_flags module_cxx_flags) 390 if(MODULE_FORCE_STATIC) 394 endif(MODULE_FORCE_STATIC) 396 if(NOT MODULE_HEADERS_ONLY) 397 if(NOT MODULE_NO_INIT OR RESOURCE_FILES) 398 find_package(CppMicroServices QUIET NO_MODULE REQUIRED) 400 if(NOT MODULE_NO_INIT) 401 usFunctionGenerateModuleInit(CPP_FILES) 404 set(binary_res_files ) 405 set(source_res_files ) 407 if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/resource
") 408 set(res_dir resource) 409 elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Resources
") 410 set(res_dir Resources) 412 message(SEND_ERROR "Resources specified but ${CMAKE_CURRENT_SOURCE_DIR}/resource directory not found.
") 414 foreach(res_file ${RESOURCE_FILES}) 415 if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${res_dir}/${res_file}) 416 list(APPEND binary_res_files "${res_file}
") 418 list(APPEND source_res_files "${res_file}
") 422 # Add a source level dependencies on resource files 423 usFunctionGetResourceSource(TARGET ${MODULE_TARGET} OUT CPP_FILES) 429 qt5_wrap_ui(Q${KITNAME}_GENERATED_UI_CPP ${UI_FILES}) 432 qt5_wrap_cpp(Q${KITNAME}_GENERATED_MOC_CPP ${MOC_H_FILES} OPTIONS -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) 435 qt5_add_resources(Q${KITNAME}_GENERATED_QRC_CPP ${QRC_FILES}) 439 set(Q${KITNAME}_GENERATED_CPP ${Q${KITNAME}_GENERATED_CPP} ${Q${KITNAME}_GENERATED_UI_CPP} ${Q${KITNAME}_GENERATED_MOC_CPP} ${Q${KITNAME}_GENERATED_QRC_CPP}) 441 mitkFunctionOrganizeSources( 448 MOC ${Q${KITNAME}_GENERATED_MOC_CPP} 449 GEN_QRC ${Q${KITNAME}_GENERATED_QRC_CPP} 450 GEN_UI ${Q${KITNAME}_GENERATED_UI_CPP} 454 ${CPP_FILES} ${H_FILES} ${GLOBBED__H_FILES} ${CORRESPONDING__H_FILES} ${TXX_FILES} 455 ${TOOL_CPPS} ${TOOL_GUI_CPPS}) 457 if(MODULE_SUBPROJECTS) 458 set_property(SOURCE ${coverage_sources} APPEND PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) 461 # --------------------------------------------------------------- 462 # Create the actual module target 464 if(MODULE_HEADERS_ONLY) 465 add_library(${MODULE_TARGET} INTERFACE) 466 set_property(TARGET ${MODULE_TARGET} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Modules
") 468 if(MODULE_EXECUTABLE) 469 add_executable(${MODULE_TARGET} 470 ${MODULE_CPP_FILES} ${coverage_sources} ${CPP_FILES_GENERATED} ${Q${KITNAME}_GENERATED_CPP} 471 ${DOX_FILES} ${UI_FILES} ${QRC_FILES}) 472 set_property(TARGET ${MODULE_TARGET} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Modules/Executables
") 473 set(_us_module_name main) 475 add_library(${MODULE_TARGET} ${_STATIC} 476 ${coverage_sources} ${CPP_FILES_GENERATED} ${Q${KITNAME}_GENERATED_CPP} 477 ${DOX_FILES} ${UI_FILES} ${QRC_FILES}) 478 set_property(TARGET ${MODULE_TARGET} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Modules
") 479 set(_us_module_name ${MODULE_TARGET}) 482 # Apply properties to the module target. 483 target_compile_definitions(${MODULE_TARGET} PRIVATE US_MODULE_NAME=${_us_module_name}) 486 string(REPLACE " " ";
" module_c_flags "${module_c_flags}
") 487 target_compile_options(${MODULE_TARGET} PRIVATE ${module_c_flags}) 489 if(module_c_flags_debug) 490 string(REPLACE " " ";
" module_c_flags_debug "${module_c_flags_debug}
") 491 target_compile_options(${MODULE_TARGET} PRIVATE $<$<CONFIG:Debug>:${module_c_flags_debug}>) 493 if(module_c_flags_release) 494 string(REPLACE " " ";
" module_c_flags_release "${module_c_flags_release}
") 495 target_compile_options(${MODULE_TARGET} PRIVATE $<$<CONFIG:Release>:${module_c_flags_release}>) 499 string(REPLACE " " ";
" module_cxx_flags "${module_cxx_flags}
") 500 target_compile_options(${MODULE_TARGET} PRIVATE ${module_cxx_flags}) 502 if(module_cxx_flags_debug) 503 string(REPLACE " " ";
" module_cxx_flags_debug "${module_cxx_flags_debug}
") 504 target_compile_options(${MODULE_TARGET} PRIVATE $<$<CONFIG:Debug>:${module_cxx_flags_debug}>) 506 if(module_cxx_flags_release) 507 string(REPLACE " " ";
" module_cxx_flags_release "${module_cxx_flags_release}
") 508 target_compile_options(${MODULE_TARGET} PRIVATE $<$<CONFIG:Release>:${module_cxx_flags_release}>) 512 set_property(TARGET ${MODULE_TARGET} PROPERTY US_MODULE_NAME ${_us_module_name}) 514 # Add additional library search directories to a global property which 515 # can be evaluated by other CMake macros, e.g. our install scripts. 516 if(MODULE_ADDITIONAL_LIBS) 517 target_link_libraries(${MODULE_TARGET} PRIVATE ${MODULE_ADDITIONAL_LIBS}) 518 get_property(_mitk_additional_library_search_paths GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS) 519 foreach(_lib_filepath ${MODULE_ADDITIONAL_LIBS}) 520 get_filename_component(_search_path "${_lib_filepath}
" PATH) 522 list(APPEND _mitk_additional_library_search_paths "${_search_path}
") 525 if(_mitk_additional_library_search_paths) 526 list(REMOVE_DUPLICATES _mitk_additional_library_search_paths) 527 set_property(GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS ${_mitk_additional_library_search_paths}) 531 # add the target name to a global property which is used in the top-level 532 # CMakeLists.txt file to export the target 533 set_property(GLOBAL APPEND PROPERTY MITK_MODULE_TARGETS ${MODULE_TARGET}) 534 if(MODULE_AUTOLOAD_WITH) 535 # for auto-loaded modules, adapt the output directory 536 add_dependencies(${_module_autoload_meta_target} ${MODULE_TARGET}) 538 set(_module_output_prop RUNTIME_OUTPUT_DIRECTORY) 540 set(_module_output_prop LIBRARY_OUTPUT_DIRECTORY) 542 set(_module_output_dir ${CMAKE_${_module_output_prop}}/${MODULE_AUTOLOAD_WITH}) 543 get_target_property(_module_is_imported ${MODULE_AUTOLOAD_WITH} IMPORTED) 544 if(NOT _module_is_imported) 545 # if the auto-loading module is not imported, get its location 546 # and put the auto-load module relative to it. 547 get_target_property(_module_output_dir ${MODULE_AUTOLOAD_WITH} ${_module_output_prop}) 548 set_target_properties(${MODULE_TARGET} PROPERTIES 549 ${_module_output_prop} ${_module_output_dir}/${MODULE_AUTOLOAD_WITH}) 551 set_target_properties(${MODULE_TARGET} PROPERTIES 552 ${_module_output_prop} ${CMAKE_${_module_output_prop}}/${MODULE_AUTOLOAD_WITH}) 554 set_target_properties(${MODULE_TARGET} PROPERTIES 555 MITK_AUTOLOAD_DIRECTORY ${MODULE_AUTOLOAD_WITH}) 557 # add the auto-load module name as a property 558 set_property(TARGET ${MODULE_AUTOLOAD_WITH} APPEND PROPERTY MITK_AUTOLOAD_TARGETS ${MODULE_TARGET}) 562 usFunctionAddResources(TARGET ${MODULE_TARGET} 563 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${res_dir} 564 FILES ${binary_res_files}) 567 usFunctionAddResources(TARGET ${MODULE_TARGET} 568 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${res_dir} 569 FILES ${source_res_files}) 571 if(binary_res_files OR source_res_files) 572 usFunctionEmbedResources(TARGET ${MODULE_TARGET}) 575 if(MODULE_DEPRECATED_SINCE) 576 set_property(TARGET ${MODULE_TARGET} PROPERTY MITK_MODULE_DEPRECATED_SINCE ${MODULE_DEPRECATED_SINCE}) 579 # create export macros 580 if (NOT MODULE_EXECUTABLE) 581 set(_export_macro_name ) 582 if(MITK_LEGACY_EXPORT_MACRO_NAME) 583 set(_export_macro_names 584 EXPORT_MACRO_NAME ${MODULE_EXPORT_DEFINE} 585 NO_EXPORT_MACRO_NAME ${MODULE_NAME}_NO_EXPORT 586 DEPRECATED_MACRO_NAME ${MODULE_NAME}_DEPRECATED 587 NO_DEPRECATED_MACRO_NAME ${MODULE_NAME}_NO_DEPRECATED 590 generate_export_header(${MODULE_NAME} 591 ${_export_macro_names} 592 EXPORT_FILE_NAME ${MODULE_NAME}Exports.h 596 target_include_directories(${MODULE_TARGET} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) 600 # --------------------------------------------------------------- 601 # Properties for both header-only and compiled modules 603 if(MODULE_HEADERS_ONLY) 604 set(_module_property_type INTERFACE) 606 set(_module_property_type PUBLIC) 609 if(MODULE_TARGET_DEPENDS) 610 add_dependencies(${MODULE_TARGET} ${MODULE_TARGET_DEPENDS}) 613 if(MODULE_SUBPROJECTS AND NOT MODULE_HEADERS_ONLY) 614 set_property(TARGET ${MODULE_TARGET} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) 615 foreach(subproject ${MODULE_SUBPROJECTS}) 616 add_dependencies(${subproject} ${MODULE_TARGET}) 620 set(DEPENDS "${MODULE_DEPENDS}
") 621 if(NOT MODULE_NO_INIT AND NOT MODULE_HEADERS_ONLY) 622 # Add a CppMicroServices dependency implicitly, since it is 623 # needed for the generated "module initialization
" code. 624 set(DEPENDS "CppMicroServices;${DEPENDS}
") 626 if(DEPENDS OR MODULE_PACKAGE_DEPENDS) 627 mitk_use_modules(TARGET ${MODULE_TARGET} 629 PACKAGES ${MODULE_PACKAGE_DEPENDS} 633 if(NOT MODULE_C_MODULE) 634 target_compile_features(${MODULE_TARGET} ${_module_property_type} ${MITK_CXX_FEATURES}) 637 # add include directories 638 if(MODULE_INTERNAL_INCLUDE_DIRS) 639 target_include_directories(${MODULE_TARGET} PRIVATE ${MODULE_INTERNAL_INCLUDE_DIRS}) 641 if(NOT MODULE_NO_DEFAULT_INCLUDE_DIRS) 642 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include) 643 target_include_directories(${MODULE_TARGET} ${_module_property_type} include) 645 target_include_directories(${MODULE_TARGET} ${_module_property_type} .) 647 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src) 648 target_include_directories(${MODULE_TARGET} PRIVATE src) 651 target_include_directories(${MODULE_TARGET} ${_module_property_type} ${MODULE_INCLUDE_DIRS}) 655 # ----------------------------------------------------------------- 656 # Record missing dependency information 659 if(MODULE_DESCRIPTION) 660 set(MODULE_DESCRIPTION "${MODULE_DESCRIPTION} (missing dependencies: ${_MISSING_DEP})
") 662 set(MODULE_DESCRIPTION "(missing dependencies: ${_MISSING_DEP})
") 665 if(NOT MODULE_NO_FEATURE_INFO) 666 add_feature_info(${MODULE_NAME} MODULE_IS_ENABLED "${MODULE_DESCRIPTION}
") 669 set(MODULE_NAME ${MODULE_NAME} PARENT_SCOPE) 670 set(MODULE_TARGET ${MODULE_TARGET} PARENT_SCOPE) 671 set(MODULE_IS_ENABLED ${MODULE_IS_ENABLED} PARENT_SCOPE) 672 set(MODULE_SUBPROJECTS ${MODULE_SUBPROJECTS} PARENT_SCOPE)
static const unsigned int unknown
Unknown size marker.