Haibo Huang | d00577c | 2020-02-28 16:35:48 -0800 | [diff] [blame] | 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
| 2 | # file Copyright.txt or https://cmake.org/licensing for details. |
| 3 | |
| 4 | #[=======================================================================[.rst: |
| 5 | MacroAddFileDependencies |
| 6 | ------------------------ |
| 7 | |
| 8 | MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...) |
| 9 | |
| 10 | Using the macro MACRO_ADD_FILE_DEPENDENCIES() is discouraged. There |
| 11 | are usually better ways to specify the correct dependencies. |
| 12 | |
| 13 | MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...) is just a |
| 14 | convenience wrapper around the OBJECT_DEPENDS source file property. |
| 15 | You can just use set_property(SOURCE <file> APPEND PROPERTY |
| 16 | OBJECT_DEPENDS depend_files) instead. |
| 17 | #]=======================================================================] |
| 18 | |
| 19 | macro (MACRO_ADD_FILE_DEPENDENCIES _file) |
| 20 | |
| 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 | |
| 28 | set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}") |
| 29 | |
| 30 | endmacro () |