diff --git a/CMake/mitkFunctionGetLibrarySearchPaths.cmake b/CMake/mitkFunctionGetLibrarySearchPaths.cmake index ec63836a11..0c652d6236 100644 --- a/CMake/mitkFunctionGetLibrarySearchPaths.cmake +++ b/CMake/mitkFunctionGetLibrarySearchPaths.cmake @@ -1,152 +1,152 @@ function(mitkFunctionGetLibrarySearchPaths search_path intermediate_dir) set(_dir_candidates ${MITK_VTK_LIBRARY_DIRS} ${MITK_ITK_LIBRARY_DIRS} - ${MITK_BINARY_DIR}/bin ${MITK_BINARY_DIR}/bin/plugins) + "${MITK_BINARY_DIR}/bin" "${MITK_BINARY_DIR}/bin/plugins") # Determine the Qt4/5 library installation prefix set(_qmake_location ) if(MITK_USE_Qt4) set(_qmake_location ${QT_QMAKE_EXECUTABLE}) elseif(MITK_USE_Qt5 AND TARGET ${Qt5Core_QMAKE_EXECUTABLE}) get_property(_qmake_location TARGET ${Qt5Core_QMAKE_EXECUTABLE} PROPERTY IMPORT_LOCATION) endif() if(_qmake_location) if(NOT _qt_install_libs) if(WIN32) execute_process(COMMAND ${_qmake_location} -query QT_INSTALL_BINS OUTPUT_VARIABLE _qt_install_libs OUTPUT_STRIP_TRAILING_WHITESPACE) else() execute_process(COMMAND ${_qmake_location} -query QT_INSTALL_LIBS OUTPUT_VARIABLE _qt_install_libs OUTPUT_STRIP_TRAILING_WHITESPACE) endif() file(TO_CMAKE_PATH "${_qt_install_libs}" _qt_install_libs) set(_qt_install_libs ${_qt_install_libs} CACHE INTERNAL "Qt library installation prefix" FORCE) endif() if(_qt_install_libs) list(APPEND _dir_candidates ${_qt_install_libs}) endif() elseif(MITK_USE_QT) message(WARNING "The qmake executable could not be found.") endif() get_property(_additional_paths GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS) if(_additional_paths) list(APPEND _dir_candidates ${_additional_paths}) endif() if(WIN32) if(DCMTK_DIR) list(APPEND _dir_candidates "${DCMTK_DIR}/bin") endif() list(APPEND _dir_candidates "${ITK_DIR}/bin") else() if(DCMTK_DIR) list(APPEND _dir_candidates "${DCMTK_DIR}/lib") endif() list(APPEND _dir_candidates "${ITK_DIR}/lib") endif() # The code below is sub-optimal. It makes assumptions about # the structure of the build directories, pointed to by # the *_DIR variables. Instead, we should rely on package # specific "LIBRARY_DIRS" variables, if they exist. if(MITK_USE_Python AND CTK_PYTHONQT_INSTALL_DIR) - list(APPEND _dir_candidates ${CTK_PYTHONQT_INSTALL_DIR}/bin) + list(APPEND _dir_candidates "${CTK_PYTHONQT_INSTALL_DIR}/bin") endif() if(MITK_USE_Boost AND MITK_USE_Boost_LIBRARIES AND NOT MITK_USE_SYSTEM_Boost) - list(APPEND _dir_candidates ${Boost_LIBRARY_DIR}) + list(APPEND _dir_candidates "${Boost_LIBRARY_DIR}") endif() if(ACVD_DIR) - list(APPEND _dir_candidates ${ACVD_DIR}/bin) + list(APPEND _dir_candidates "${ACVD_DIR}/bin") endif() if(ANN_DIR) - list(APPEND _dir_candidates ${ANN_DIR}) + list(APPEND _dir_candidates "${ANN_DIR}") endif() if(CppUnit_DIR) - list(APPEND _dir_candidates ${CppUnit_DIR}) + list(APPEND _dir_candidates "${CppUnit_DIR}") endif() if(GLUT_DIR) - list(APPEND _dir_candidates ${GLUT_DIR}) + list(APPEND _dir_candidates "${GLUT_DIR}") endif() if(GDCM_DIR) - list(APPEND _dir_candidates ${GDCM_DIR}/bin) + list(APPEND _dir_candidates "${GDCM_DIR}/bin") endif() if(GLEW_DIR) - list(APPEND _dir_candidates ${GLEW_DIR}) + list(APPEND _dir_candidates "${GLEW_DIR}") endif() if(tinyxml_DIR) - list(APPEND _dir_candidates ${tinyxml_DIR}) + list(APPEND _dir_candidates "${tinyxml_DIR}") endif() if(OpenCV_DIR) - list(APPEND _dir_candidates ${OpenCV_DIR}/bin) + list(APPEND _dir_candidates "${OpenCV_DIR}/bin") endif() if(Poco_DIR) - list(APPEND _dir_candidates ${Poco_DIR}/lib) + list(APPEND _dir_candidates "${Poco_DIR}/lib") endif() if(Qwt_DIR) - list(APPEND _dir_candidates ${Qwt_DIR}) + list(APPEND _dir_candidates "${Qwt_DIR}") endif() if(Qxt_DIR) - list(APPEND _dir_candidates ${Qxt_DIR}) + list(APPEND _dir_candidates "${Qxt_DIR}") endif() if(SOFA_DIR) - list(APPEND _dir_candidates ${SOFA_DIR}/bin) + list(APPEND _dir_candidates "${SOFA_DIR}/bin") endif() if(MITK_USE_TOF_PMDO3 OR MITK_USE_TOF_PMDCAMCUBE OR MITK_USE_TOF_PMDCAMBOARD) - list(APPEND _dir_candidates ${MITK_PMD_SDK_DIR}/plugins) + list(APPEND _dir_candidates "${MITK_PMD_SDK_DIR}/plugins") endif() if(MITK_USE_BLUEBERRY) # quick-fix for Bug 16606 : the CTK_RUNTIME_LIB_DIRS variable was removed # so check if the variable is empty, otherwise compose the path to CTK starting if(NOT "${CTK_RUNTIME_LIBRARY_DIRS}" STREQUAL "") list(APPEND _dir_candidates ${CTK_RUNTIME_LIBRARY_DIRS}) else() if(MBILOG_ENABLE_DEBUG_MESSAGES) message(STATUS "CTK Runtime library not set, composing hard-coded path") message(STATUS "Using candidate: ${CTK_DIR}/CTK-build/bin" ) endif() - list(APPEND _dir_candidates ${CTK_DIR}/CTK-build/bin ) + list(APPEND _dir_candidates "${CTK_DIR}/CTK-build/bin" ) endif() if(DEFINED CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY) if(IS_ABSOLUTE "${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}") list(APPEND _dir_candidates "${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}") else() list(APPEND _dir_candidates "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}") endif() endif() endif() if(MITK_LIBRARY_DIRS) list(APPEND _dir_candidates ${MITK_LIBRARY_DIRS}) endif() list(REMOVE_DUPLICATES _dir_candidates) set(_search_dirs ) foreach(_dir ${_dir_candidates}) if(EXISTS "${_dir}/${intermediate_dir}") list(APPEND _search_dirs "${_dir}/${intermediate_dir}") else() - list(APPEND _search_dirs ${_dir}) + list(APPEND _search_dirs "${_dir}") endif() endforeach() # Special handling for "internal" search dirs. The intermediate directory # might not have been created yet, so we can't check for its existence. # Hence we just add it for Windows without checking. - set(_internal_search_dirs ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins) + set(_internal_search_dirs "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins") if(WIN32) foreach(_dir ${_internal_search_dirs}) - set(_search_dirs ${_dir}/${intermediate_dir} ${_search_dirs}) + set(_search_dirs "${_dir}/${intermediate_dir}" ${_search_dirs}) endforeach() else() set(_search_dirs ${_internal_search_dirs} ${_search_dirs}) endif() list(REMOVE_DUPLICATES _search_dirs) set(${search_path} ${_search_dirs} PARENT_SCOPE) endfunction() diff --git a/CMake/mitkInstallRules.cmake b/CMake/mitkInstallRules.cmake index af513a3b1d..39dde8eb41 100644 --- a/CMake/mitkInstallRules.cmake +++ b/CMake/mitkInstallRules.cmake @@ -1,103 +1,103 @@ -MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/mitk.ico ) -MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/mitk.bmp ) +MITK_INSTALL(FILES "${MITK_SOURCE_DIR}/mitk.ico") +MITK_INSTALL(FILES "${MITK_SOURCE_DIR}/mitk.bmp") # Install CTK Qt (designer) plugins if(MITK_USE_CTK) if(EXISTS ${CTK_QTDESIGNERPLUGINS_DIR}) set(_qtplugin_install_destinations) if(MACOSX_BUNDLE_NAMES) foreach(bundle_name ${MACOSX_BUNDLE_NAMES}) list(APPEND _qtplugin_install_destinations ${bundle_name}.app/Contents/MacOS/${_install_DESTINATION}/plugins/designer) endforeach() else() list(APPEND _qtplugin_install_destinations bin/plugins/designer) endif() if(NOT CMAKE_CFG_INTDIR STREQUAL ".") set(_matching_pattern_release FILES_MATCHING PATTERN "*Release*") set(_matching_pattern_debug FILES_MATCHING PATTERN "*Debug*") else() set(_matching_pattern_release ) set(_matching_pattern_debug ) endif() foreach(_qtplugin_install_dir ${_qtplugin_install_destinations}) - install(DIRECTORY ${CTK_QTDESIGNERPLUGINS_DIR}/designer/ + install(DIRECTORY "${CTK_QTDESIGNERPLUGINS_DIR}/designer/" DESTINATION ${_qtplugin_install_dir} CONFIGURATIONS Release ${_matching_pattern_release} ) - install(DIRECTORY ${CTK_QTDESIGNERPLUGINS_DIR}/designer/ + install(DIRECTORY "${CTK_QTDESIGNERPLUGINS_DIR}/designer/" DESTINATION ${_qtplugin_install_dir} CONFIGURATIONS Debug ${_matching_pattern_debug} ) endforeach() endif() endif() if(WIN32) #DCMTK Dlls install target (shared libs on gcc only) if(MINGW AND DCMTK_ofstd_LIBRARY) set(_dcmtk_libs ${DCMTK_dcmdata_LIBRARY} ${DCMTK_dcmimgle_LIBRARY} ${DCMTK_dcmnet_LIBRARY} ${DCMTK_ofstd_LIBRARY} ) foreach(_dcmtk_lib ${_dcmtk_libs}) MITK_INSTALL(FILES ${_dcmtk_lib} ) endforeach() endif() #BlueBerry # Since this file is also included from external projects, you # can only use variables which are made available through MITKConfig.cmake if(MITK_USE_BLUEBERRY) if(MINGW) - MITK_INSTALL(FILES ${MITK_BINARY_DIR}/bin/plugins/liborg_blueberry_osgi.dll) + MITK_INSTALL(FILES "${MITK_BINARY_DIR}/bin/plugins/liborg_blueberry_osgi.dll") else() if(NOT APPLE) - MITK_INSTALL(FILES ${MITK_BINARY_DIR}/bin/plugins/debug/liborg_blueberry_osgi.dll CONFIGURATIONS Debug) - MITK_INSTALL(FILES ${MITK_BINARY_DIR}/bin/plugins/release/liborg_blueberry_osgi.dll CONFIGURATIONS Release) + MITK_INSTALL(FILES "${MITK_BINARY_DIR}/bin/plugins/debug/liborg_blueberry_osgi.dll" CONFIGURATIONS Debug) + MITK_INSTALL(FILES "${MITK_BINARY_DIR}/bin/plugins/release/liborg_blueberry_osgi.dll" CONFIGURATIONS Release) endif(NOT APPLE) endif() endif() #MinGW dll if(MINGW) find_library(MINGW_RUNTIME_DLL "mingwm10.dll" HINTS ${CMAKE_FIND_ROOT_PATH}/sys-root/mingw/bin) if(MINGW_RUNTIME_DLL) MITK_INSTALL(FILES ${MINGW_RUNTIME_DLL} ) else() message(SEND_ERROR "Could not find mingwm10.dll which is needed for a proper install") endif() find_library(MINGW_GCC_RUNTIME_DLL "libgcc_s_dw2-1.dll" HINTS ${CMAKE_FIND_ROOT_PATH}/sys-root/mingw/bin) if(MINGW_GCC_RUNTIME_DLL) MITK_INSTALL(FILES ${MINGW_GCC_RUNTIME_DLL} ) else() message(SEND_ERROR "Could not find libgcc_s_dw2-1.dll which is needed for a proper install") endif() endif() else() #DCMTK Dlls install target (shared libs on gcc only) if(DCMTK_ofstd_LIBRARY) set(_dcmtk_libs ${DCMTK_dcmdata_LIBRARY} ${DCMTK_dcmimgle_LIBRARY} ${DCMTK_dcmnet_LIBRARY} ${DCMTK_ofstd_LIBRARY} ) foreach(_dcmtk_lib ${_dcmtk_libs}) #MITK_INSTALL(FILES ${_dcmtk_lib} DESTINATION lib) endforeach() endif() endif() diff --git a/CMake/mitkMacroCreateDefaultTests.cmake b/CMake/mitkMacroCreateDefaultTests.cmake index d7e99f8416..7de49845c3 100644 --- a/CMake/mitkMacroCreateDefaultTests.cmake +++ b/CMake/mitkMacroCreateDefaultTests.cmake @@ -1,61 +1,61 @@ # Create TestDriver and default tests for MITK # # CMake variables used: # # ${${KITNAME}_GUI_TESTS} : filenames of all tests that run without a parameter # ${${KITNAME}_IMAGE_GUI_TESTS : filenames of all tests that run with an image filename as parameter # ${${KITNAME}_TESTS} : filenames of all tests that run without a parameter # ${${KITNAME}_IMAGE_TESTS : filenames of all tests that run with an image filename as parameter # ${${KITNAME}_TESTIMAGES} : list of images passed as parameter for the IMAGE_TESTS # ${${KITNAME}_CUSTOM_TESTS} : filenames of custom tests which are just added to the TestDriver. Execution # of these has to be specified manually with the ADD_TEST CMake command. # macro(MITK_CREATE_DEFAULT_TESTS) # add tests which need a GUI if it is not disabled if(NOT MITK_GUI_TESTS_DISABLED) set( ${KITNAME}_TESTS ${${KITNAME}_TESTS} ${${KITNAME}_GUI_TESTS} ) set( ${KITNAME}_IMAGE_TESTS ${${KITNAME}_IMAGE_TESTS} ${${KITNAME}_IMAGE_GUI_TESTS} ) - endif(NOT MITK_GUI_TESTS_DISABLED) + endif() # # Create the TestDriver binary which contains all the tests. # create_test_sourcelist(MITKTEST_SOURCE ${KITNAME}TestDriver.cpp ${${KITNAME}_TESTS} ${${KITNAME}_IMAGE_TESTS} ${${KITNAME}_CUSTOM_TESTS} ) add_executable(${KITNAME}TestDriver ${MITKTEST_SOURCE}) set_property(TARGET ${KITNAME}TestDriver PROPERTY LABELS ${PROJECT_NAME}) target_link_libraries(${KITNAME}TestDriver ${${KITNAME}_CORE_LIBRARIES} ${${KITNAME}_LIBRARIES} ${LIBRARIES_FOR_${KITNAME}_CORE}) # # Now tell CMake which tests should be run. This is done automatically # for all tests in ${KITNAME}_TESTS and ${KITNAME}_IMAGE_TESTS. The IMAGE_TESTS # are run for each image in the TESTIMAGES list. # foreach( test ${${KITNAME}_TESTS} ) get_filename_component(TName ${test} NAME_WE) add_test(${TName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KITNAME}TestDriver ${TName}) set_property(TEST ${TName} PROPERTY LABELS ${PROJECT_NAME}) - endforeach( test ) + endforeach() foreach(image ${${KITNAME}_TESTIMAGES} ${ADDITIONAL_TEST_IMAGES} ) - if(EXISTS ${image}) + if(EXISTS "${image}") set(IMAGE_FULL_PATH ${image}) - else(EXISTS ${image}) + else() # todo: maybe search other paths as well # yes, please in mitk/Testing/Data, too set(IMAGE_FULL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Data/${image}) - endif(EXISTS ${image}) + endif() - if(EXISTS ${IMAGE_FULL_PATH}) - foreach( test ${${KITNAME}_IMAGE_TESTS} ) - get_filename_component(TName ${test} NAME_WE) - get_filename_component(ImageName ${IMAGE_FULL_PATH} NAME) - add_test(${TName}_${ImageName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KITNAME}TestDriver ${TName} ${IMAGE_FULL_PATH}) - set_property(TEST ${TName}_${ImageName} PROPERTY LABELS ${PROJECT_NAME}) - endforeach( test ) - else(EXISTS ${IMAGE_FULL_PATH}) + if(EXISTS "${IMAGE_FULL_PATH}") + foreach( test ${${KITNAME}_IMAGE_TESTS} ) + get_filename_component(TName ${test} NAME_WE) + get_filename_component(ImageName ${IMAGE_FULL_PATH} NAME) + add_test(${TName}_${ImageName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KITNAME}TestDriver ${TName} ${IMAGE_FULL_PATH}) + set_property(TEST ${TName}_${ImageName} PROPERTY LABELS ${PROJECT_NAME}) + endforeach() + else() message("!!!!! No such file: ${IMAGE_FULL_PATH} !!!!!") - endif(EXISTS ${IMAGE_FULL_PATH}) - endforeach( image ) -endmacro(MITK_CREATE_DEFAULT_TESTS) + endif() + endforeach() +endmacro() diff --git a/CMake/mitkMacroInstall.cmake b/CMake/mitkMacroInstall.cmake index 847816af90..5efadc76c3 100644 --- a/CMake/mitkMacroInstall.cmake +++ b/CMake/mitkMacroInstall.cmake @@ -1,172 +1,177 @@ # # MITK specific install macro # # On Mac everything is installed for each bundle listed in MACOSX_BUNDLE_NAMES # by replacing the DESTINATION parameter. Everything else is passed to the CMake INSTALL command # # Usage: MITK_INSTALL( ) # macro(MITK_INSTALL) set(ARGS ${ARGN}) set(install_directories "") list(FIND ARGS DESTINATION _destination_index) # set(_install_DESTINATION "") if(_destination_index GREATER -1) message(SEND_ERROR "MITK_INSTALL macro must not be called with a DESTINATION parameter.") ### This code was a try to replace a given DESTINATION #math(EXPR _destination_index ${_destination_index} + 1) #list(GET ARGS ${_destination_index} _install_DESTINATION) #string(REGEX REPLACE ^bin "" _install_DESTINATION ${_install_DESTINATION}) else() if(NOT MACOSX_BUNDLE_NAMES) install(${ARGS} DESTINATION bin) else() foreach(bundle_name ${MACOSX_BUNDLE_NAMES}) install(${ARGS} DESTINATION ${bundle_name}.app/Contents/MacOS/${_install_DESTINATION}) endforeach() endif() endif() endmacro() # Fix _target_location # This is used in several install macros macro(_fixup_target) if(NOT intermediate_dir) if(WIN32 AND NOT MINGW) set(intermediate_dir Release) else() set(intermediate_dir .) endif() endif() mitkFunctionGetLibrarySearchPaths(_search_paths ${intermediate_dir}) install(CODE " set(_bundle_dest_dir \"${_bundle_dest_dir}\") if(_bundle_dest_dir) set(_bin_path \"\${CMAKE_INSTALL_PREFIX}/\${_bundle_dest_dir}\") else() set(_bin_path \"\${CMAKE_INSTALL_PREFIX}/bin\") endif() macro(gp_item_default_embedded_path_override item default_embedded_path_var) get_filename_component(_item_name \"\${item}\" NAME) get_filename_component(_item_path \"\${item}\" PATH) # We have to fix all path references to build trees for plugins if(NOT _item_path MATCHES \"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}\") # item with relative path or embedded path pointing to some build dir set(full_path \"full_path-NOTFOUND\") file(GLOB_RECURSE full_path \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/\${_item_name} ) list(LENGTH full_path full_path_length) if(full_path_length GREATER 1) list(GET full_path 0 full_path) endif() get_filename_component(_item_path \"\${full_path}\" PATH) endif() set(_plugins_path \"\${_bin_path}/plugins\") if(_item_path STREQUAL _plugins_path OR (_item_path MATCHES \"\${_plugins_path}/\" AND _item_name MATCHES \"liborg\") # this is for legacy BlueBerry bundle support ) # Only fix plugins message(\"override: \${item}\") message(\"found file: \${_item_path}/\${_item_name}\") if(APPLE) string(REPLACE \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir} @executable_path \${default_embedded_path_var} \"\${_item_path}\" ) else() set(\${default_embedded_path_var} \"\${_item_path}\") endif() message(\"override result: \${\${default_embedded_path_var}}\") endif() endmacro(gp_item_default_embedded_path_override) macro(gp_resolved_file_type_override file type) if(NOT APPLE) get_filename_component(_file_path \"\${file}\" PATH) get_filename_component(_file_name \"\${file}\" NAME) if(_file_path MATCHES \"^\${CMAKE_INSTALL_PREFIX}\") set(\${type} \"local\") endif() if(_file_name MATCHES gdiplus) set(\${type} \"system\") endif(_file_name MATCHES gdiplus) endif() endmacro(gp_resolved_file_type_override) if(NOT APPLE) macro(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var) if(\${item} MATCHES \"blueberry_osgi\") get_filename_component(_item_name \${item} NAME) set(\${resolved_item_var} \"\${exepath}/plugins/\${_item_name}\") set(\${resolved_var} 1) endif() endmacro() endif() if(\"${_install_GLOB_PLUGINS}\" STREQUAL \"TRUE\") set(GLOBBED_PLUGINS ) set(_bb_osgi_lib \"\${_bin_path}/liborg_blueberry_osgi${CMAKE_SHARED_LIBRARY_SUFFIX}\") if(EXISTS \"\${_bb_osgi_lib}\") list(APPEND GLOBBED_PLUGINS \"\${_bb_osgi_lib}\") endif() # Iterate over all sub-directories which contain plug-ins # (BlueBerry plug-ins, Qt plug-ins, and auto-load modules) file(GLOB _children \"\${_bin_path}/*\") foreach(_child \${_children}) if(IS_DIRECTORY \${_child}) set(_plugins ) set(_modules ) file(GLOB_RECURSE _plugins \"\${_child}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\") if(_plugins) list(APPEND GLOBBED_PLUGINS \${_plugins}) endif() # Now glob for all modules which might have a different extensions. # E.g. on MacOS plugins could have a .dylib extension as well as a .so extension if(NOT \"${CMAKE_SHARED_MODULE_SUFFIX}\" STREQUAL \"\" AND NOT \"${CMAKE_SHARED_MODULE_SUFFIX}\" STREQUAL \"${CMAKE_SHARED_LIBRARY_SUFFIX}\") file(GLOB_RECURSE _modules \"\${_child}/*${CMAKE_SHARED_MODULE_SUFFIX}\") endif() if(_modules) list(APPEND GLOBBED_PLUGINS \${_modules}) endif() endif() endforeach() endif() set(PLUGINS ) foreach(_plugin ${_install_PLUGINS} \${GLOBBED_PLUGINS}) get_filename_component(_plugin_realpath \${_plugin} REALPATH) list(APPEND PLUGINS \${_plugin_realpath}) endforeach() if(PLUGINS) list(REMOVE_DUPLICATES PLUGINS) endif(PLUGINS) message(\"globbed plugins: \${PLUGINS}\") set(CMAKE_MODULE_PATH ${MITK_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} ) - set(DIRS ${_search_paths} ${_install_LIBRARY_DIRS}) + set(DIRS \"${_search_paths}\") + + set(_additional_search_paths ${_install_LIBRARY_DIRS}) + if(_additional_search_paths) + set(DIRS \"\${DIRS};\${_additional_search_paths}\") + endif() foreach(_plugin \${PLUGINS}) get_filename_component(_pluginpath \${_plugin} PATH) - list(APPEND DIRS \${_pluginpath}) + list(APPEND DIRS \"\${_pluginpath}\") endforeach(_plugin) list(REMOVE_DUPLICATES DIRS) # use custom version of BundleUtilities include(BundleUtilities) fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${_target_location}\" \"\${PLUGINS}\" \"\${DIRS}\") ") endmacro() diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 06d041b39e..414886ca75 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -1,43 +1,42 @@ #----------------------------------------------------------------------------- # Configure the CppMicroServices build #----------------------------------------------------------------------------- set(US_ENABLE_AUTOLOADING_SUPPORT ON) set(US_ENABLE_THREADING_SUPPORT ON) -set(US_IS_EMBEDDED OFF) # Don't create a "doc" target and don't install the documentation files set(US_NO_DOCUMENTATION ON) # Don't use an install component for SDK artifacts set(US_SDK_INSTALL_COMPONENT "") if(BUILD_TESTING) set(US_BUILD_TESTING ON) endif() add_subdirectory(CppMicroServices) set(CppMicroServices_DIR ${CMAKE_CURRENT_BINARY_DIR}/CppMicroServices CACHE PATH "Path to the CppMicroServices library") mark_as_advanced(CppMicroServices_DIR) # create a custom module conf file for CppMicroServices function(_generate_cppmicroservices_conf) set(MODULE_IS_ENABLED 1) set(MODULE_NAME CppMicroServices) set(MODULE_PROVIDES ${MODULE_NAME}) set(MODULE_EXTRA_CMAKE_CODE "find_package(CppMicroServices NO_MODULE REQUIRED)") set(MODULE_INCLUDE_DIRS "\${CppMicroServices_INCLUDE_DIRS}") set(CppMicroServices_CONFIG_FILE "${CMAKE_BINARY_DIR}/${MODULES_CONF_DIRNAME}/CppMicroServicesConfig.cmake" CACHE INTERNAL "Path to module config" FORCE) configure_file(${MITK_SOURCE_DIR}/CMake/moduleConf.cmake.in ${CppMicroServices_CONFIG_FILE} @ONLY) endfunction() _generate_cppmicroservices_conf() #----------------------------------------------------------------------------- # Add the MITK Core library #----------------------------------------------------------------------------- set(MITK_DEFAULT_SUBPROJECTS MITK-Core) add_subdirectory(Code) diff --git a/MITKConfig.cmake.in b/MITKConfig.cmake.in index 98c1e5dd1d..711e90e576 100644 --- a/MITKConfig.cmake.in +++ b/MITKConfig.cmake.in @@ -1,196 +1,196 @@ # Update the CMake module path set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "@MITK_SOURCE_DIR@/CMake") set(CppMicroServices_DIR "@MITK_BINARY_DIR@/Core/CppMicroServices") # Include MITK macros include(MacroParseArguments) include(mitkFunctionCheckMitkCompatibility) include(mitkFunctionOrganizeSources) include(mitkFunctionCreateWindowsBatchScript) include(mitkFunctionInstallProvisioningFiles) include(mitkFunctionInstallAutoLoadModules) include(mitkFunctionGetLibrarySearchPaths) include(mitkFunctionUseModules) include(mitkMacroCreateModuleConf) include(mitkFunctionCheckModuleDependencies) include(mitkFunctionCreateModule) include(mitkMacroCreateExecutable) include(mitkMacroCheckModule) include(mitkMacroCreateModuleTests) include(mitkFunctionAddCustomModuleTest) include(mitkMacroUseModule) include(mitkMacroMultiplexPicType) include(mitkMacroInstall) include(mitkMacroInstallHelperApp) include(mitkMacroInstallTargets) include(mitkMacroGenerateToolsLibrary) include(mitkMacroCreateCTKPlugin) include(mitkMacroGetPMDPlatformString) # The MITK version number set(MITK_VERSION_MAJOR "@MITK_VERSION_MAJOR@") set(MITK_VERSION_MINOR "@MITK_VERSION_MINOR@") set(MITK_VERSION_PATCH "@MITK_VERSION_PATCH@") set(MITK_VERSION_STRING "@MITK_VERSION_STRING@") # MITK compiler flags set(MITK_C_FLAGS "@MITK_C_FLAGS@") set(MTTK_C_FLAGS_DEBUG "@MITK_C_FLAGS_DEBUG@") set(MITK_C_FLAGS_RELEASE "@MITK_C_FLAGS_RELEASE@") set(MITK_CXX_FLAGS "@MITK_CXX_FLAGS@") set(MTTK_CXX_FLAGS_DEBUG "@MITK_CXX_FLAGS_DEBUG@") set(MITK_CXX_FLAGS_RELEASE "@MITK_CXX_FLAGS_RELEASE@") set(MITK_EXE_LINKER_FLAGS "@MITK_EXE_LINKER_FLAGS@") set(MITK_SHARED_LINKER_FLAGS "@MITK_SHARED_LINKER_FLAGS@") set(MITK_MODULE_LINKER_FLAGS "@MITK_MODULE_LINKER_FLAGS@") # Internal version numbers, used for approximate compatibility checks # of a MITK development version (non-release). set(MITK_VERSION_PLUGIN_SYSTEM 2) # dropped legacy BlueBerry plug-in CMake support # MITK specific variables set(MITK_SOURCE_DIR "@MITK_SOURCE_DIR@") set(MITK_BINARY_DIR "@MITK_BINARY_DIR@") set(MITK_CMAKE_DIR "@MITK_CMAKE_DIR@") set(UTILITIES_DIR "@UTILITIES_DIR@") set(REGISTER_QFUNCTIONALITY_CPP_IN "@REGISTER_QFUNCTIONALITY_CPP_IN@") set(MITK_MODULES_PACKAGE_DEPENDS_DIR "@MITK_MODULES_PACKAGE_DEPENDS_DIR@") set(MODULES_PACKAGE_DEPENDS_DIRS "@MODULES_PACKAGE_DEPENDS_DIRS@") set(MITK_DOXYGEN_TAGFILE_NAME "@MITK_DOXYGEN_TAGFILE_NAME@") if(MODULES_CONF_DIRS) list(APPEND MODULES_CONF_DIRS "@MODULES_CONF_DIRS@") list(REMOVE_DUPLICATES MODULES_CONF_DIRS) else() set(MODULES_CONF_DIRS "@MODULES_CONF_DIRS@") endif() set(MODULES_CONF_DIRNAME "@MODULES_CONF_DIRNAME@") foreach(_module @MITK_MODULE_NAMES@) set(${_module}_CONFIG_FILE "@MITK_BINARY_DIR@/@MODULES_CONF_DIRNAME@/${_module}Config.cmake") endforeach() # External projects set(CTK_DIR "@CTK_DIR@") set(ANN_DIR "@ANN_DIR@") set(CppUnit_DIR "@CppUnit_DIR@") set(GLEW_DIR "@GLEW_DIR@") set(tinyxml_DIR "@tinyxml_DIR@") set(ITK_DIR "@ITK_DIR@") set(VTK_DIR "@VTK_DIR@") set(DCMTK_DIR "@DCMTK_DIR@") set(GDCM_DIR "@GDCM_DIR@") set(BOOST_ROOT "@BOOST_ROOT@") set(OpenCV_DIR "@OpenCV_DIR@") set(Poco_DIR "@Poco_DIR@") set(SOFA_DIR "@SOFA_DIR@") set(Qwt_DIR "@Qwt_DIR@") set(Qxt_DIR "@Qxt_DIR@") set(MITK_QMAKE_EXECUTABLE "@QT_QMAKE_EXECUTABLE@") set(MITK_DATA_DIR "@MITK_DATA_DIR@") # External SDK directories set(MITK_PMD_SDK_DIR @MITK_PMD_SDK_DIR@) # MITK use variables set(MITK_USE_QT @MITK_USE_QT@) set(MITK_USE_Qt4 @MITK_USE_Qt4@) set(MITK_USE_Qt5 @MITK_USE_Qt5@) set(MITK_DESIRED_QT_VERSION @DESIRED_QT_VERSION@) set(MITK_USE_BLUEBERRY @MITK_USE_BLUEBERRY@) set(MITK_USE_SYSTEM_Boost @MITK_USE_SYSTEM_Boost@) set(MITK_USE_Boost @MITK_USE_Boost@) set(MITK_USE_Boost_LIBRARIES @MITK_USE_Boost_LIBRARIES@) set(MITK_USE_CTK @MITK_USE_CTK@) set(MITK_USE_DCMTK @MITK_USE_DCMTK@) set(MITK_USE_OpenCV @MITK_USE_OpenCV@) set(MITK_USE_SOFA @MITK_USE_SOFA@) set(MITK_USE_Python @MITK_USE_Python@) if(MITK_USE_Qt4) set(MITK_QT4_MINIMUM_VERSION @MITK_QT4_MINIMUM_VERSION@) find_package(Qt4 ${MITK_QT4_MINIMUM_VERSION} REQUIRED) elseif(MITK_USE_Qt5) set(MITK_QT5_MINIMUM_VERSION @MITK_QT5_MINIMUM_VERSION@) find_package(Qt5Core ${MITK_QT5_MINIMUM_VERSION} REQUIRED) endif() # MITK ToF use variables set(MITK_TOF_PMDCAMCUBE_AVAILABLE @MITK_USE_TOF_PMDCAMCUBE@) if(MITK_TOF_PMDCAMCUBE_AVAILABLE AND NOT ${PROJECT_NAME} STREQUAL "MITK") option(MITK_USE_TOF_PMDCAMCUBE "Enable support for PMD Cam Cube" @MITK_USE_TOF_PMDCAMCUBE@) mark_as_advanced(MITK_USE_TOF_PMDCAMCUBE) endif() set(MITK_TOF_PMDCAMBOARD_AVAILABLE @MITK_USE_TOF_PMDCAMBOARD@) if(MITK_TOF_PMDCAMBOARD_AVAILABLE AND NOT ${PROJECT_NAME} STREQUAL "MITK") option(MITK_USE_TOF_PMDCAMBOARD "Enable support for PMD Cam Board" @MITK_USE_TOF_PMDCAMBOARD@) mark_as_advanced(MITK_USE_TOF_PMDCAMBOARD) endif() set(MITK_TOF_PMDO3_AVAILABLE @MITK_USE_TOF_PMDO3@) if(MITK_TOF_PMDO3_AVAILABLE AND NOT ${PROJECT_NAME} STREQUAL "MITK") option(MITK_USE_TOF_PMDO3 "Enable support for PMD =3" @MITK_USE_TOF_PMDO3@) mark_as_advanced(MITK_USE_TOF_PMDO3) endif() set(MITK_TOF_KINECT_AVAILABLE @MITK_USE_TOF_KINECT@) if(MITK_TOF_KINECT_AVAILABLE AND NOT ${PROJECT_NAME} STREQUAL "MITK") option(MITK_USE_TOF_KINECT "Enable support for Kinect" @MITK_USE_TOF_KINECT@) mark_as_advanced(MITK_USE_TOF_KINECT) endif() set(MITK_TOF_MESASR4000_AVAILABLE @MITK_USE_TOF_MESASR4000@) if(MITK_TOF_MESASR4000_AVAILABLE AND NOT ${PROJECT_NAME} STREQUAL "MITK") option(MITK_USE_TOF_MESASR4000 "Enable support for MESA SR4000" @MITK_USE_TOF_MESASR4000@) mark_as_advanced(MITK_USE_TOF_MESASR4000) endif() if(MITK_USE_IGT) - #include(${MITK_DIR}/mitkIGTConfig.cmake) + #include("${MITK_DIR}/mitkIGTConfig.cmake") endif() # Install rules for ToF libraries loaded at runtime -include(@MITK_BINARY_DIR@/mitkToFHardwareInstallRules.cmake) +include("@MITK_BINARY_DIR@/mitkToFHardwareInstallRules.cmake") if(NOT MITK_EXPORTS_FILE_INCLUDED) if(EXISTS "@MITK_EXPORTS_FILE@") set(MITK_EXPORTS_FILE_INCLUDED 1) include("@MITK_EXPORTS_FILE@") - endif(EXISTS "@MITK_EXPORTS_FILE@") + endif() endif() # BlueBerry support if(MITK_USE_BLUEBERRY) set(BlueBerry_DIR "@MITK_BINARY_DIR@/BlueBerry") # Don't include the BlueBerry exports file, since the targets are # also exported in the MITK exports file set(BB_PLUGIN_EXPORTS_FILE_INCLUDED 1) find_package(BlueBerry) if(NOT BlueBerry_FOUND) message(SEND_ERROR "MITK does not seem to be configured with BlueBerry support. Set MITK_USE_BLUEBERRY to ON in your MITK build configuration.") - endif(NOT BlueBerry_FOUND) + endif() - set(MITK_PLUGIN_USE_FILE @MITK_PLUGIN_USE_FILE@) + set(MITK_PLUGIN_USE_FILE "@MITK_PLUGIN_USE_FILE@") if(MITK_PLUGIN_USE_FILE) - if(EXISTS ${MITK_PLUGIN_USE_FILE}) - include(${MITK_PLUGIN_USE_FILE}) + if(EXISTS "${MITK_PLUGIN_USE_FILE}") + include("${MITK_PLUGIN_USE_FILE}") endif() endif() set(MITK_PLUGIN_PROVISIONING_FILE "@MITK_EXTAPP_PROVISIONING_FILE@") set(MITK_PROVISIONING_FILES "${BLUEBERRY_PLUGIN_PROVISIONING_FILE}" "${MITK_PLUGIN_PROVISIONING_FILE}") -endif(MITK_USE_BLUEBERRY) +endif() # Set properties on exported targets @MITK_EXPORTED_TARGET_PROPERTIES@