ctkFunctionGetPluginDependencies.cmake 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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
  10. function(ctkFunctionGetPluginDependencies var_deps)
  11. ctkMacroParseArguments(MY "PLUGINS" "ALL" ${ARGN})
  12. # Sanity checks
  13. if(NOT var_deps)
  14. message(FATAL_ERROR "Missing variable name as the first argument for storing the result")
  15. endif()
  16. if(NOT MY_PLUGINS)
  17. message(FATAL_ERROR "Missing plug-in names")
  18. endif()
  19. if(MY_ALL)
  20. ctkFunctionGetTargetDependencies(_targets TARGETS ${MY_PLUGINS} ALL)
  21. else()
  22. ctkFunctionGetTargetDependencies(_targets TARGETS ${MY_PLUGINS})
  23. endif()
  24. set(_plugins )
  25. foreach(_target ${_targets})
  26. if(_target MATCHES _)
  27. list(APPEND _plugins ${_target})
  28. endif()
  29. endforeach()
  30. set(${var_deps} ${_plugins} PARENT_SCOPE)
  31. endfunction()