Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkFunctionInstallThirdPartyCTKPlugins.cmake
Go to the documentation of this file.
1 #! \brief Install external CTK plug-ins.
2 #!
3 #! Use this macro to call mitkFunctionInstallCTKPlugin() for all known
4 #! or given external CTK plug-ins. The arguments given until a known argument name
5 #! are treated as plug-in target names. If none are given, all known
6 #! external plug-ins will be installed.
7 #!
8 #! This macro supports multiple MacOSX Bundles by checking the variable
9 #! MACOSX_BUNDLE_NAMES. If it exists, each plug-in will be installed
10 #! in each given bundle (under <bundle_name>/Contents/MacOS/plugins), otherwise
11 #! it will be installed in "bin/plugins".
12 #!
13 #! Typical usage (will install all known external plug-ins):
14 #! \code
15 #! FunctionInstallThirdPartyCTKPlugins()
16 #! \endcode
17 #!
18 #! To install only the org.commontk.eventadmin plug-in for example, call:
19 #! \code
20 #! FunctionInstallThirdPartyCTKPlugins(org.commontk.eventadmin)
21 #! \endcode
22 #!
23 #! \note If you provide specific plug-in names as arguments, you must
24 #! make sure that your list includes the transitive closure of all plug-in
25 #! dependencies. Use the ctkFunctionGetPluginDependencies() macro to obtain
26 #! all dependencies of a specified set of plug-ins.
27 #!
29 
30  cmake_parse_arguments(_INSTALL "" "" "EXCLUDE" ${ARGN})
31 
32  set(install_directories "")
33  if(NOT MACOSX_BUNDLE_NAMES)
34  set(install_directories bin/plugins)
35  else()
36  foreach(bundle_name ${MACOSX_BUNDLE_NAMES})
37  list(APPEND install_directories ${bundle_name}.app/Contents/MacOS/plugins)
38  endforeach(bundle_name)
39  endif(NOT MACOSX_BUNDLE_NAMES)
40 
41  if(_INSTALL_DEFAULT_ARGS)
42  set(_ctk_plugins )
43  foreach(_ctk_plugin ${_INSTALL_DEFAULT_ARGS})
44  string(REPLACE "." "_" _plugin_target ${_ctk_plugin})
45  list(APPEND _ctk_plugins ${_ctk_plugin})
46  endforeach()
47  else()
48  ctkFunctionGetAllPluginTargets(_ctk_plugins)
49  endif()
50 
51  if(_INSTALL_EXCLUDE)
52  set(_exclude_list )
53  foreach(_exclude ${_INSTALL_EXCLUDE})
54  string(REPLACE "." "_" _exclude_target ${_exclude})
55  list(APPEND _exclude_list ${_exclude_target})
56  endforeach()
57  list(REMOVE_ITEM _ctk_plugins ${_INSTALL_EXCLUDE})
58  endif()
59 
60  ctkMacroGetAllNonProjectTargetLibraries("${_ctk_plugins}" _third_party_ctk_plugins)
61  if(_third_party_ctk_plugins)
62  foreach(install_subdir ${install_directories})
63  mitkFunctionInstallCTKPlugin(TARGETS ${_third_party_ctk_plugins}
64  DESTINATION "${install_subdir}")
65  endforeach()
66  endif()
67 
68 endfunction()
mitkFunctionInstallThirdPartyCTKPlugins()
Install external CTK plug-ins.