CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkFunctionGetPluginDependencies.cmake
Go to the documentation of this file.
1#!
2#! \brief Stores all known plug-in dependencies (potentially also from external projects)
3#! in the variable specified by the first argument.
4#!
5#! \param var_deps (required) A variable name containing the output.
6#! \param PLUGINS (required) A list of plug-ins (target names or symbolic names) for which the
7#! set of dependencies should be obtained.
8#! \param ALL (option) Include external dependencies.
9#! \ingroup CMakeUtilities
10function(ctkFunctionGetPluginDependencies var_deps)
11
12 ctkMacroParseArguments(MY "PLUGINS" "ALL" ${ARGN})
13
14 # Sanity checks
15 if(NOT var_deps)
16 message(FATAL_ERROR "Missing variable name as the first argument for storing the result")
17 endif()
18
19 if(NOT MY_PLUGINS)
20 message(FATAL_ERROR "Missing plug-in names")
21 endif()
22
23 if(MY_ALL)
24 ctkFunctionGetTargetDependencies(_targets TARGETS ${MY_PLUGINS} ALL)
25 else()
26 ctkFunctionGetTargetDependencies(_targets TARGETS ${MY_PLUGINS})
27 endif()
28
29 set(_plugins )
30 foreach(_target ${_targets})
31 if(_target MATCHES _)
32 list(APPEND _plugins ${_target})
33 endif()
34 endforeach()
35
36 set(${var_deps} ${_plugins} PARENT_SCOPE)
37
38endfunction()