2 #! \brief Stores all target dependencies (potentially also from external projects)
3 #! in the variable specified by the first argument.
5 #! \param var_deps (required) A variable name containing the output.
6 #! \param TARGETS (required) A list of targets (library targets or plug-in targets/symbolic names)
7 #! for which the set of dependencies should be obtained.
8 #! \param ALL (option) Include external dependencies.
9 #! \ingroup CMakeUtilities
10 function(ctkFunctionGetTargetDependencies var_deps)
12 ctkMacroParseArguments(MY "TARGETS" "ALL" ${ARGN})
16 message(FATAL_ERROR "Missing variable name as the first argument for storing the result")
20 message(FATAL_ERROR "Missing target names")
24 foreach(_target ${MY_TARGETS})
25 # convenience conversion for plug-in targets
26 string(REPLACE "." "_" _target ${_target})
27 # assume the variable ${_target}_DEPENDENCIES was set during
28 # a previous invocation of the ctkMacroValidateBuildOptions macro.
29 list(APPEND _targets ${${_target}_DEPENDENCIES})
33 list(REMOVE_DUPLICATES _targets)
35 # remove external targets not belonging to the current project
36 ctkMacroGetAllProjectTargetLibraries("${_targets}" _targets)
40 set(${var_deps} ${_targets} PARENT_SCOPE)