diff --git a/CMake/mitkMacroUseModule.cmake b/CMake/mitkMacroUseModule.cmake index 409a345e36..cfb80a953a 100644 --- a/CMake/mitkMacroUseModule.cmake +++ b/CMake/mitkMacroUseModule.cmake @@ -1,71 +1,84 @@ macro(MITK_USE_MODULE) + set(MODULE_FIRST_LEVEL_DEPENDS ${ARGN}) set(DEPENDS "") set(DEPENDS_BEFORE "not initialized") # check for each parameter if it is a package (3rd party) - foreach(package ${ARGN}) + foreach(package ${MODULE_FIRST_LEVEL_DEPENDS}) set(is_package) foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) if(EXISTS "${dir}/MITK_${package}_Config.cmake") list(APPEND PACKAGE_DEPENDS ${package}) set(is_package 1) break() endif() endforeach() if(NOT is_package) list(APPEND DEPENDS ${package}) endif() endforeach(package) while(NOT "${DEPENDS}" STREQUAL "${DEPENDS_BEFORE}") set(DEPENDS_BEFORE ${DEPENDS}) foreach(dependency ${DEPENDS}) if(NOT ${dependency}_CONFIG_FILE) message(SEND_ERROR "Missing module: ${dependency}") endif() include(${${dependency}_CONFIG_FILE}) list(APPEND DEPENDS ${${dependency}_DEPENDS}) list(APPEND PACKAGE_DEPENDS ${${dependency}_PACKAGE_DEPENDS}) endforeach(dependency) if(DEPENDS) list(REMOVE_DUPLICATES DEPENDS) list(SORT DEPENDS) endif(DEPENDS) if(PACKAGE_DEPENDS) list(REMOVE_DUPLICATES PACKAGE_DEPENDS) list(SORT PACKAGE_DEPENDS) endif(PACKAGE_DEPENDS) endwhile() # CMake Debug set(ALL_DEPENDENCIES ${DEPENDS}) foreach(dependency ${DEPENDS} ${MODULE_DEPENDS_INTERNAL}) if(NOT ${dependency}_CONFIG_FILE) message(SEND_ERROR "Missing module ${dependency}") endif() + include(${${dependency}_CONFIG_FILE}) + if(${dependency}_IS_DEPRECATED AND NOT MODULE_IS_DEPRECATED) + # Only print the message if the dependent module + # is not deprecated itself and if it is a first-level dependency. + if(MODULE_FIRST_LEVEL_DEPENDS) + list(FIND MODULE_FIRST_LEVEL_DEPENDS ${dependency} _index) + if(_index GREATER -1) + message(WARNING "Module ${dependency} is deprecated since ${@MODULE_NAME@_DEPRECATED_SINCE}") + endif() + endif() + endif() + set(ALL_INCLUDE_DIRECTORIES ${ALL_INCLUDE_DIRECTORIES} ${${dependency}_INCLUDE_DIRS}) set(ALL_LIBRARIES ${ALL_LIBRARIES} ${${dependency}_PROVIDES}) set(ALL_LIBRARY_DIRS ${ALL_LIBRARY_DIRS} ${${dependency}_LIBRARY_DIRS}) if(TARGET ${dependency}-autoload) list(APPEND ALL_META_DEPENDENCIES ${dependency}-autoload) endif() endforeach(dependency) foreach(package ${PACKAGE_DEPENDS}) foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) if(EXISTS "${dir}/MITK_${package}_Config.cmake") include("${dir}/MITK_${package}_Config.cmake") break() endif() endforeach() #set(ALL_INCLUDE_DIRECTORIES ${ALL_INCLUDE_DIRECTORIES} ${${package}_INCLUDE_DIRS}) # set(ALL_LIBRARIES ${ALL_LIBRARIES} ${${package}_LIBRARIES}) endforeach(package) set(ALL_LIBRARIES ${ALL_LIBRARIES} ${MODULE_ADDITIONAL_LIBS}) set(ALL_INCLUDE_DIRECTORIES ${MITK_BINARY_DIR} ${ALL_INCLUDE_DIRECTORIES} ${MODULE_INCLUDE_DIRS} ${MODULE_INTERNAL_INCLUDE_DIRS} ${MODULES_CONF_DIRS}) if(ALL_INCLUDE_DIRECTORIES) list(REMOVE_DUPLICATES ALL_INCLUDE_DIRECTORIES) endif() if(ALL_LIBRARY_DIRS) list(REMOVE_DUPLICATES ALL_LIBRARY_DIRS) endif(ALL_LIBRARY_DIRS) endmacro(MITK_USE_MODULE) diff --git a/CMake/moduleConf.cmake.in b/CMake/moduleConf.cmake.in index 2205564a8a..38d759039d 100644 --- a/CMake/moduleConf.cmake.in +++ b/CMake/moduleConf.cmake.in @@ -1,17 +1,12 @@ set(@MODULE_NAME@_IS_ENABLED "@MODULE_IS_ENABLED@") set(@MODULE_NAME@_IS_DEPRECATED "@MODULE_IS_DEPRECATED@") set(@MODULE_NAME@_DEPRECATED_SINCE "@MODULE_DEPRECATED_SINCE@") if(@MODULE_NAME@_IS_ENABLED) @MODULE_EXTRA_CMAKE_CODE@ set(@MODULE_NAME@_INCLUDE_DIRS "@MODULE_INCLUDE_DIRS@") set(@MODULE_NAME@_PROVIDES "@MODULE_PROVIDES@") set(@MODULE_NAME@_DEPENDS "@MODULE_DEPENDS@") set(@MODULE_NAME@_PACKAGE_DEPENDS "@MODULE_PACKAGE_DEPENDS@") set(@MODULE_NAME@_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@") - if(@MODULE_NAME@_IS_DEPRECATED AND NOT MODULE_IS_DEPRECATED) - # Only print the message if the dependent module - # is not deprecated itself. - message(WARNING "Module @MODULE_NAME@ is deprecated since ${@MODULE_NAME@_DEPRECATED_SINCE}") - endif() endif(@MODULE_NAME@_IS_ENABLED)