MacroAddFileDependencies.cmake 1.0 KB

123456789101112131415161718192021222324252627282930
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. MacroAddFileDependencies
  5. ------------------------
  6. MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...)
  7. Using the macro MACRO_ADD_FILE_DEPENDENCIES() is discouraged. There
  8. are usually better ways to specify the correct dependencies.
  9. MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...) is just a
  10. convenience wrapper around the OBJECT_DEPENDS source file property.
  11. You can just use set_property(SOURCE <file> APPEND PROPERTY
  12. OBJECT_DEPENDS depend_files) instead.
  13. #]=======================================================================]
  14. macro (MACRO_ADD_FILE_DEPENDENCIES _file)
  15. get_source_file_property(_deps ${_file} OBJECT_DEPENDS)
  16. if (_deps)
  17. set(_deps ${_deps} ${ARGN})
  18. else ()
  19. set(_deps ${ARGN})
  20. endif ()
  21. set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}")
  22. endmacro ()