Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkFunctionInstallCTKPlugin.cmake
Go to the documentation of this file.
1 
2 #! \brief Install CTK plug-ins.
3 #!
4 #! Installs the given list of CTK plug-in targets in the given
5 #! <code>DESTINATION</code>. If an entry in <code>TARGETS</code>
6 #! is not a known target, a warning will be issued. This macro
7 #! can also install imported plug-in targets.
8 #!
9 #! \note This macro is usually not called directly. It is used in
10 #! mitk_create_module() and mitkFunctionInstallThirdPartyCTKPlugins().
11 #!
12 #! \param TARGETS (optional) A list of plug-ins (target names) to install.
13 #! \param DESTINATION (optional) The install destination. Defaults to "bin/".
15 
16  cmake_parse_arguments(_INSTALL "" "DESTINATION" "TARGETS" ${ARGN})
17 
18  if(NOT _INSTALL_DESTINATION)
19  set(_INSTALL_DESTINATION "bin/")
20  else()
21  set(_INSTALL_DESTINATION "${_INSTALL_DESTINATION}/")
22  endif()
23 
24  foreach(_install_target ${_INSTALL_TARGETS})
25  if(TARGET ${_install_target})
26  get_target_property(_is_imported ${_install_target} IMPORTED)
27  if(_is_imported)
28  get_target_property(_import_loc_debug ${_install_target} IMPORTED_LOCATION_DEBUG)
29  get_target_property(_import_loc_release ${_install_target} IMPORTED_LOCATION_RELEASE)
30  get_filename_component(_target_filename_debug "${_import_loc_debug}" NAME)
31  get_filename_component(_target_filename_release "${_import_loc_release}" NAME)
32  install(FILES ${_import_loc_debug}
33  DESTINATION ${_INSTALL_DESTINATION}
34  CONFIGURATIONS Debug)
35  install(FILES ${_import_loc_release}
36  DESTINATION ${_INSTALL_DESTINATION}
37  CONFIGURATIONS Release)
38  if(UNIX AND NOT APPLE)
39  if(_target_filename_debug)
40  install(CODE "file(RPATH_REMOVE
41  FILE \"\${CMAKE_INSTALL_PREFIX}/${_INSTALL_DESTINATION}/${_target_filename_debug}\")")
42  endif()
43  if(_target_filename_release)
44  install(CODE "file(RPATH_REMOVE
45  FILE \"\${CMAKE_INSTALL_PREFIX}/${_INSTALL_DESTINATION}/${_target_filename_release}\")")
46  endif()
47  endif()
48  else()
49  install(TARGETS ${_install_target}
50  RUNTIME DESTINATION ${_INSTALL_DESTINATION}
51  LIBRARY DESTINATION ${_INSTALL_DESTINATION}
52  #ARCHIVE DESTINATION ${_INSTALL_DESTINATION}
53  )
54  endif()
55  else()
56  message(WARNING "Ignoring unknown plug-in target \"${_install_target}\" for installation.")
57  endif()
58  endforeach()
59 
60 endfunction()
static const unsigned int unknown
Unknown size marker.
Definition: jsoncpp.cpp:1583
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
Definition: jsoncpp.cpp:244
mitkFunctionInstallCTKPlugin()
Install CTK plug-ins.