mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-26 00:00:39 -05:00
AddFileDependencies: Avoid leaking temporary variable
Convert `add_file_dependencies` to a function. Simplify the implementation using `set_property` with `APPEND`.
This commit is contained in:
committed by
Brad King
parent
acb33d0904
commit
0f6fc388ea
@@ -9,20 +9,13 @@ Add dependencies to a source file.
|
|||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
ADD_FILE_DEPENDENCIES(<source> <files>)
|
add_file_dependencies(<source> <files>)
|
||||||
|
|
||||||
Adds the given ``<files>`` to the dependencies of file ``<source>``.
|
Adds the given ``<files>`` to the dependencies of file ``<source>``.
|
||||||
#]=======================================================================]
|
#]=======================================================================]
|
||||||
|
|
||||||
macro(ADD_FILE_DEPENDENCIES _file)
|
function(add_file_dependencies _file)
|
||||||
|
|
||||||
get_source_file_property(_deps ${_file} OBJECT_DEPENDS)
|
set_property(SOURCE "${_file}" APPEND PROPERTY OBJECT_DEPENDS "${ARGN}")
|
||||||
if (_deps)
|
|
||||||
set(_deps ${_deps} ${ARGN})
|
|
||||||
else ()
|
|
||||||
set(_deps ${ARGN})
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}")
|
endfunction()
|
||||||
|
|
||||||
endmacro()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user