1 #! Helper function that gets all library search paths. 5 #! mitkFunctionGetLibrarySearchPaths(search_path intermediate_dir [DEBUG|MINSIZEREL|RELWITHDEBINFO]) 8 #! The function creates the variable ${search_path}. The variable intermediate_dir contains 9 #! paths that should be added to the search_path but should not be checked for existance, 10 #! because the are not yet created. The option DEBUG, MINSIZEREL or RELWITHDEBINFO can be used to indicate that 11 #! not the paths for release configuration are requested but the debug, min size release or "release with debug info" 17 cmake_parse_arguments(PARSE_ARGV 2 GLS
"RELEASE;DEBUG;MINSIZEREL;RELWITHDEBINFO" "" "")
20 "${MITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY}" 21 "${MITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins" 22 "${MITK_CMAKE_LIBRARY_OUTPUT_DIRECTORY}" 23 "${MITK_CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugins" 25 if(MITK_EXTERNAL_PROJECT_PREFIX)
26 list(APPEND _dir_candidates
27 "${MITK_EXTERNAL_PROJECT_PREFIX}/bin" 28 "${MITK_EXTERNAL_PROJECT_PREFIX}/lib" 32 # Determine the Qt5 library installation prefix 34 if(MITK_USE_Qt5 AND
TARGET ${Qt5Core_QMAKE_EXECUTABLE})
35 get_property(_qmake_location
TARGET ${Qt5Core_QMAKE_EXECUTABLE}
36 PROPERTY IMPORT_LOCATION)
39 if(NOT _qt_install_libs)
41 execute_process(COMMAND ${_qmake_location} -query QT_INSTALL_BINS
42 OUTPUT_VARIABLE _qt_install_libs
43 OUTPUT_STRIP_TRAILING_WHITESPACE)
45 execute_process(COMMAND ${_qmake_location} -query QT_INSTALL_LIBS
46 OUTPUT_VARIABLE _qt_install_libs
47 OUTPUT_STRIP_TRAILING_WHITESPACE)
49 file(TO_CMAKE_PATH "${_qt_install_libs}
" _qt_install_libs) 50 set(_qt_install_libs ${_qt_install_libs} CACHE INTERNAL "Qt library installation prefix
" FORCE) 53 list(APPEND _dir_candidates ${_qt_install_libs}) 56 message(WARNING "The qmake executable could not be found.
") 59 get_property(_additional_paths GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS) 61 if(TARGET OpenSSL::SSL) 63 get_target_property(_openssl_location OpenSSL::SSL IMPORTED_LOCATION_DEBUG) 65 get_target_property(_openssl_location OpenSSL::SSL IMPORTED_LOCATION_RELEASE) 68 get_filename_component(_openssl_location ${_openssl_location} DIRECTORY) 69 set(_openssl_location "${_openssl_location}/../../bin
") 70 if(EXISTS ${_openssl_location}) 71 get_filename_component(_openssl_location ${_openssl_location} ABSOLUTE) 72 list(APPEND _dir_candidates ${_openssl_location}) 78 FIND_PACKAGE(HDF5 COMPONENTS C HL NO_MODULE REQUIRED shared) 79 get_target_property(_location hdf5-shared LOCATION) 80 get_filename_component(_location ${_location} PATH) 81 list(APPEND _additional_paths ${_location}) 83 # This is a work-around. The hdf5-config.cmake file is not robust enough 84 # to be included several times via find_pakcage calls. 85 set(HDF5_LIBRARIES ${HDF5_LIBRARIES} PARENT_SCOPE) 88 # we cannot use _find_package(Vigra) here because the vigra-config.cmake file 89 # always includes the target-exports files without using an include guard. This 90 # would lead to errors when another find_package(Vigra) call is processed. The 91 # (bad) assumption here is that for the time being, only the Classification module 94 list(APPEND _additional_paths ${Vigra_DIR}/lib) 96 list(APPEND _additional_paths ${Vigra_DIR}/bin) 100 if(_additional_paths) 101 list(APPEND _dir_candidates ${_additional_paths}) 104 # The code below is sub-optimal. It makes assumptions about 105 # the structure of the build directories, pointed to by 106 # the *_DIR variables. Instead, we should rely on package 107 # specific "LIBRARY_DIRS
" variables, if they exist. 109 list(APPEND _dir_candidates "${ITK_DIR}/bin
") 112 if(MITK_USE_MatchPoint) 114 list(APPEND _dir_candidates "${MatchPoint_DIR}/bin
") 116 list(APPEND _dir_candidates "${MatchPoint_DIR}/lib
") 120 # If OpenCV is built within the MITK superbuild set the binary directory 121 # according to the lib path provided by OpenCV. 122 # In the case where an external OpenCV is provided use the binary directory 123 # of this OpenCV directory 126 if (EXISTS ${OpenCV_LIB_PATH}) 127 list(APPEND _dir_candidates "${OpenCV_LIB_PATH}/../bin
") # OpenCV is built in superbuild 129 list(APPEND _dir_candidates "${OpenCV_DIR}/bin
") # External OpenCV build is used 135 list(APPEND _dir_candidates "${CTK_DIR}/CMakeExternals/Install/bin
") 136 get_filename_component(_python_dir "${Python3_EXECUTABLE}
" DIRECTORY) 137 list(APPEND _dir_candidates "${_python_dir}
") 140 if(MITK_USE_TOF_PMDO3 OR MITK_USE_TOF_PMDCAMCUBE OR MITK_USE_TOF_PMDCAMBOARD) 141 list(APPEND _dir_candidates "${MITK_PMD_SDK_DIR}/plugins
" "${MITK_PMD_SDK_DIR}/bin
") 145 list(APPEND _dir_candidates "${CTK_LIBRARY_DIRS}
") 146 foreach(_ctk_library ${CTK_LIBRARIES}) 147 if(${_ctk_library}_LIBRARY_DIRS) 148 list(APPEND _dir_candidates "${${_ctk_library}_LIBRARY_DIRS}
") 153 if(MITK_USE_BLUEBERRY) 154 if(DEFINED CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY) 155 if(IS_ABSOLUTE "${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}
") 156 list(APPEND _dir_candidates "${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}
") 158 list(APPEND _dir_candidates "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}
") 163 if(MITK_LIBRARY_DIRS) 164 list(APPEND _dir_candidates ${MITK_LIBRARY_DIRS}) 167 ################################################################### 168 #get the search paths added by the mitkFunctionAddLibrarySearchPath 169 file(GLOB _additional_path_info_files "${MITK_SUPERBUILD_BINARY_DIR}/MITK-AdditionalLibPaths
mitkFunctionGetLibrarySearchPaths(search_path, intermediate_dir)