Files
CMake/Modules/AddFileDependencies.cmake
Anakin Skywalker 0f6fc388ea AddFileDependencies: Avoid leaking temporary variable
Convert `add_file_dependencies` to a function.
Simplify the implementation using `set_property` with `APPEND`.
2021-02-08 12:21:43 -05:00

22 lines
640 B
CMake

# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
AddFileDependencies
-------------------
Add dependencies to a source file.
.. code-block:: cmake
add_file_dependencies(<source> <files>)
Adds the given ``<files>`` to the dependencies of file ``<source>``.
#]=======================================================================]
function(add_file_dependencies _file)
set_property(SOURCE "${_file}" APPEND PROPERTY OBJECT_DEPENDS "${ARGN}")
endfunction()