1 #! MITK specific cross plattform install macro 3 #! Usage: MITK_INSTALL_HELPER_APP(target1 [target2] ....) 6 cmake_parse_arguments(_install
"GLOB_PLUGINS" "" "TARGETS;EXECUTABLES;PLUGINS;LIBRARY_DIRS" ${ARGN})
7 list(APPEND _install_TARGETS ${_install_DEFAULT_ARGS})
9 # TODO: how to supply to correct intermediate directory??
10 # CMAKE_CFG_INTDIR is not expanded to actual values inside the install(CODE
"...") macro ...
11 set(intermediate_dir .)
13 set(intermediate_dir Release)
19 list(APPEND DIRS
"/usr/lib")
22 foreach(_target ${_install_EXECUTABLES})
23 set(_qt_conf_install_dirs
"")
24 set(_target_locations
"")
26 get_filename_component(_target_name ${_target}
NAME)
29 if(NOT MACOSX_BUNDLE_NAMES)
30 set(_qt_conf_install_dirs bin)
31 set(_target_locations bin/${_target_name})
32 install(PROGRAMS ${_target} DESTINATION bin)
34 foreach(bundle_name ${MACOSX_BUNDLE_NAMES})
35 list(APPEND _qt_conf_install_dirs ${bundle_name}.app/Contents/Resources)
36 set(_current_target_location ${bundle_name}.app/Contents/MacOS/${_target_name})
37 list(APPEND _target_locations ${_current_target_location})
38 install(PROGRAMS ${_target} DESTINATION ${bundle_name}.app/Contents/MacOS/)
40 endif(NOT MACOSX_BUNDLE_NAMES)
42 set(_target_location bin/${_target_name})
43 set(_qt_conf_install_dirs bin)
44 install(PROGRAMS ${_target} DESTINATION bin)
45 if(UNIX AND NOT WIN32)
46 # Remove the rpath from helper applications. We assume that all dependencies 47 # are installed into the same location as the helper application. 48 install(CODE
"file(RPATH_REMOVE 49 FILE \"\${CMAKE_INSTALL_PREFIX}/${_target_location}\")")
53 foreach(_target_location ${_target_locations})
55 endforeach(_target_location)
57 #-------------------------------------------------------------------------------- 58 # install a qt.conf file 59 # this inserts some cmake code into the install script to write the file 61 set(_qt_conf_plugin_install_prefix .)
63 set(_qt_conf_plugin_install_prefix ./MacOS)
65 foreach(_qt_conf_install_dir ${_qt_conf_install_dirs})
66 install(CODE
"file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${_qt_conf_install_dir}/qt.conf\" \" 68 Prefix=${_qt_conf_plugin_install_prefix}
mitkFunctionGetLibrarySearchPaths(search_path, intermediate_dir)
MITK_INSTALL_HELPER_APP()