2 # MITK specific install macro 4 # On Mac everything is installed for each bundle listed in MACOSX_BUNDLE_NAMES 5 # by replacing the DESTINATION parameter. Everything else is passed to the CMake INSTALL command 7 # Usage: MITK_INSTALL( ) 12 set(install_directories
"")
13 list(FIND ARGS DESTINATION _destination_index)
14 if(_destination_index GREATER -1)
15 message(SEND_ERROR
"MITK_INSTALL macro must not be called with a DESTINATION parameter.")
17 # If there is a FILES_MATCHING parameter we need to make sure that the 18 # DESTINATION parameter is located in front of it. 21 list(FIND ARGS FILES_MATCHING _files_matching_index)
22 if(_files_matching_index GREATER -1)
24 list(LENGTH ARGS _count)
25 while(_index LESS _files_matching_index )
26 list(GET ARGS ${_index} _arg)
27 list(APPEND ARGS1 ${_arg})
28 math(EXPR _index
"${_index}+1")
30 while(_index LESS _count)
31 list(GET ARGS ${_index} _arg)
32 list(APPEND ARGS2 ${_arg})
33 math(EXPR _index
"${_index}+1")
38 if(NOT MACOSX_BUNDLE_NAMES)
39 install(${ARGS1} DESTINATION bin/${_install_DESTINATION} ${ARGS2})
41 foreach(bundle_name ${MACOSX_BUNDLE_NAMES})
42 install(${ARGS1} DESTINATION ${bundle_name}.app/Contents/MacOS/${_install_DESTINATION} ${ARGS2})
49 # Fix _target_location 50 # This is used in several install macros 53 if(NOT intermediate_dir)
55 set(intermediate_dir Release)
57 set(intermediate_dir .)
65 set(_bundle_dest_dir \"${_bundle_dest_dir}\") 67 set(_bin_path \"\${CMAKE_INSTALL_PREFIX}/\${_bundle_dest_dir}\") 69 set(_bin_path \"\${CMAKE_INSTALL_PREFIX}/bin\") 72 macro(gp_item_default_embedded_path_override item default_embedded_path_var) 73 get_filename_component(_item_name \"\${item}\" NAME) 74 get_filename_component(_item_path \"\${item}\" PATH) 76 # We have to fix all path references to build trees for plugins 78 if(NOT _item_path MATCHES \"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}\") 79 # item with relative path or embedded path pointing to some build dir 80 set(full_path \"full_path-NOTFOUND\") 81 file(GLOB_RECURSE full_path \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}/\${_item_name} ) 82 list(LENGTH full_path full_path_length) 83 if(full_path_length GREATER 1) 84 list(GET full_path 0 full_path) 86 get_filename_component(_item_path \"\${full_path}\" PATH) 89 set(_plugins_path \"\${_bin_path}/plugins\") 91 if(_item_path STREQUAL _plugins_path 92 OR (_item_path MATCHES \"\${_plugins_path}/\" AND _item_name MATCHES \"liborg\") # this is for legacy BlueBerry bundle support 95 message(\"override: \${item}\") 96 message(\"found file: \${_item_path}/\${_item_name}\") 99 \${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir} 100 @executable_path \${default_embedded_path_var} \"\${_item_path}\" ) 102 set(\${default_embedded_path_var} \"\${_item_path}\") 104 message(\"override result: \${\${default_embedded_path_var}}\") 106 endmacro(gp_item_default_embedded_path_override) 108 macro(gp_resolved_file_type_override file type) 110 get_filename_component(_file_path \"\${file}\" PATH) 111 get_filename_component(_file_name \"\${file}\" NAME) 112 if(_file_path MATCHES \"^\${CMAKE_INSTALL_PREFIX}\") 113 set(\${type} \"local\") 115 if(_file_name MATCHES gdiplus) 116 set(\${type} \"system\") 117 endif(_file_name MATCHES gdiplus) 120 if(file MATCHES \"BluetoothApis.dll\") 121 set(\${type} \"system\" ) 124 endmacro(gp_resolved_file_type_override) 127 macro(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var) 128 if(\${item} MATCHES \"blueberry_core_runtime\") 129 get_filename_component(_item_name \${item} NAME) 130 set(\${resolved_item_var} \"\${exepath}/plugins/\${_item_name}\") 131 set(\${resolved_var} 1) 136 if(\"${_install_GLOB_PLUGINS}\" STREQUAL \"TRUE\") 137 set(GLOBBED_PLUGINS ) 138 set(_bb_runtime_lib \"\${_bin_path}/liborg_blueberry_core_runtime${CMAKE_SHARED_LIBRARY_SUFFIX}\") 139 if(EXISTS \"\${_bb_runtime_lib}\") 140 list(APPEND GLOBBED_PLUGINS \"\${_bb_runtime_lib}\") 143 # Iterate over all sub-directories which contain plug-ins 144 # (BlueBerry plug-ins, Qt plug-ins, and auto-load modules) 145 file(GLOB _children \"\${_bin_path}/*\") 146 foreach(_child \${_children}) 147 if(IS_DIRECTORY \${_child}) 150 file(GLOB_RECURSE _plugins \"\${_child}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\") 152 list(APPEND GLOBBED_PLUGINS \${_plugins}) 154 # Now glob for all modules which might have a different extensions. 155 # E.g. on MacOS plugins could have a .dylib extension as well as a .so extension 156 if(NOT \"${CMAKE_SHARED_MODULE_SUFFIX}\" STREQUAL \"\" AND NOT \"${CMAKE_SHARED_MODULE_SUFFIX}\" STREQUAL \"${CMAKE_SHARED_LIBRARY_SUFFIX}\") 157 file(GLOB_RECURSE _modules \"\${_child}/*${CMAKE_SHARED_MODULE_SUFFIX}\") 160 list(APPEND GLOBBED_PLUGINS \${_modules}) 166 file(GLOB _match_point_plugins \"\${_bin_path}/mdra-*\") 169 foreach(_plugin ${_install_PLUGINS} \${GLOBBED_PLUGINS} \${_match_point_plugins}) 170 get_filename_component(_plugin_realpath \${_plugin} REALPATH) 171 list(APPEND PLUGINS \${_plugin_realpath}) 175 list(REMOVE_DUPLICATES PLUGINS) 177 message(\"globbed plugins: \${PLUGINS}\") 179 set(CMAKE_MODULE_PATH ${MITK_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} ) 181 set(DIRS \"${_search_paths}\") 183 set(_additional_search_paths ${_install_LIBRARY_DIRS}) 184 if(_additional_search_paths) 185 set(DIRS \"\${DIRS};\${_additional_search_paths}\") 187 foreach(_plugin \${PLUGINS}) 188 get_filename_component(_pluginpath \${_plugin} PATH) 189 list(APPEND DIRS \"\${_pluginpath}\") 192 list(REMOVE_DUPLICATES DIRS) 194 # use custom version of BundleUtilities 195 include(BundleUtilities) 196 set(BU_CHMOD_BUNDLE_ITEMS ON) 198 fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${_target_location}\" \"\${PLUGINS}\" \"\${DIRS}\" IGNORE_ITEM Python) 201 include(FixMacOSInstaller)
mitkFunctionGetLibrarySearchPaths(search_path, intermediate_dir)