2 #! \brief Install auto-load modules needed by plug-ins.
4 #! Uses the MITK_AUTOLOAD_TARGETS target property of the plug-in
5 #! targets to extract a list of auto-load target names which will
6 #! be installed in the given <code>DESTINATION</code> with an appropriate
7 #! sub-directory appended. If an entry in <code>TARGETS</code>
8 #! is not a known target, a warning will be issued. This macro
9 #! can also work on imported plug-in targets.
11 #! \note This macro is usually not called directly. It is indirectly
12 #! called by a call to FunctionCreateBlueBerryApplication().
14 #! \param PLUGINS A list of plug-in targets from which installable audo-load modules are derived.
15 #! \param DESTINATION The install destination, e.g. "bin".
18 cmake_parse_arguments(_INSTALL
"" "DESTINATION" "PLUGINS" ${ARGN})
20 if(NOT _INSTALL_PLUGINS)
21 message(SEND_ERROR
"PLUGINS argument is required")
24 if(NOT _INSTALL_DESTINATION)
25 message(SEND_ERROR "DESTINATION argument is required")
28 foreach(_install_plugin ${_INSTALL_PLUGINS})
29 if(
TARGET ${_install_plugin})
30 get_target_property(_autoload_targets ${_install_plugin} MITK_AUTOLOAD_TARGETS)
31 if (_autoload_targets)
32 foreach(_autoload_target ${_autoload_targets})
33 get_target_property(_autoload_subdir ${_autoload_target} MITK_AUTOLOAD_DIRECTORY)
34 if(NOT _autoload_subdir)
35 message(WARNING
"Target ${_autoload_target} does not seem to be an auto-load module. Skipping installation.")
36 else(NOT _${_autoload_target}_installed)
38 set(_module_install_dir ${_INSTALL_DESTINATION}/${_autoload_subdir})
40 get_target_property(_is_imported ${_autoload_target} IMPORTED)
42 get_target_property(_target_loc_debug ${_autoload_target} IMPORTED_LOCATION_DEBUG)
43 get_target_property(_target_loc_release ${_autoload_target} IMPORTED_LOCATION_RELEASE)
45 # Since we need to use install(FILE ...) we need to get the absolute path to the
46 # module. This is a bit tricky and we only support Debug and Release configurations
47 # on multi-configuration build systems.
49 get_target_property(_target_loc_debug ${_autoload_target} RUNTIME_OUTPUT_DIRECTORY)
51 get_target_property(_target_loc_debug ${_autoload_target} LIBRARY_OUTPUT_DIRECTORY)
53 set(_target_loc_release ${_target_loc_debug})
54 if(NOT CMAKE_CFG_INTDIR STREQUAL
".")
55 set(_target_loc_debug
"${_target_loc_debug}/Debug")
56 set(_target_loc_release "${_target_loc_release}/Release
")
58 set(_target_loc_debug ${_target_loc_debug}/${CMAKE_SHARED_LIBRARY_PREFIX}${_autoload_target}${CMAKE_SHARED_LIBRARY_SUFFIX})
59 set(_target_loc_release ${_target_loc_release}/${CMAKE_SHARED_LIBRARY_PREFIX}${_autoload_target}${CMAKE_SHARED_LIBRARY_SUFFIX})
62 get_filename_component(_target_filename_debug "${_target_loc_debug}
" NAME)
63 get_filename_component(_target_filename_release "${_target_loc_release}
" NAME)
64 install(FILES ${_target_loc_debug}
65 DESTINATION ${_module_install_dir}
67 install(FILES ${_target_loc_release}
68 DESTINATION ${_module_install_dir}
69 CONFIGURATIONS Release)
71 set(_${_autoload_target}_installed 1)
73 if(UNIX AND NOT APPLE)
74 if(_target_filename_debug)
75 install(CODE "file(RPATH_REMOVE
76 FILE \
"\${CMAKE_INSTALL_PREFIX}/${_module_install_dir}/${_target_filename_debug}\")")
78 if(_target_filename_release)
79 install(CODE "file(RPATH_REMOVE
80 FILE \"\${CMAKE_INSTALL_PREFIX}/${_module_install_dir}/${_target_filename_release}\
")")
87 message(WARNING "Ignoring
unknown target \"${_install_plugin}\
" for installation.")
95 cmake_parse_arguments(_INSTALL "" "APP_NAME" "PLUGINS" ${ARGN})
99 set(_destination ${_INSTALL_APP_NAME}.app/Contents/MacOS)
103 PLUGINS ${_INSTALL_PLUGINS}
104 DESTINATION ${_destination}
static const unsigned int unknown
Unknown size marker.
mitkFunctionInstallAutoLoadModules()
Install auto-load modules needed by plug-ins.
BlueBerryApplicationInstallHook()