MacroAddFileDependencies.cmake 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. # - MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...)
  2. # Using the macro MACRO_ADD_FILE_DEPENDENCIES() is discouraged. There are usually
  3. # better ways to specify the correct dependencies.
  4. #
  5. # MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...) is just a convenience
  6. # wrapper around the OBJECT_DEPENDS source file property. You can just
  7. # use set_property(SOURCE <file> APPEND PROPERTY OBJECT_DEPENDS depend_files) instead.
  8. #=============================================================================
  9. # Copyright 2006-2009 Kitware, Inc.
  10. #
  11. # Distributed under the OSI-approved BSD License (the "License");
  12. # see accompanying file Copyright.txt for details.
  13. #
  14. # This software is distributed WITHOUT ANY WARRANTY; without even the
  15. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. # See the License for more information.
  17. #=============================================================================
  18. # (To distribute this file outside of CMake, substitute the full
  19. # License text for the above reference.)
  20. macro (MACRO_ADD_FILE_DEPENDENCIES _file)
  21. get_source_file_property(_deps ${_file} OBJECT_DEPENDS)
  22. if (_deps)
  23. set(_deps ${_deps} ${ARGN})
  24. else ()
  25. set(_deps ${ARGN})
  26. endif ()
  27. set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}")
  28. endmacro ()