From d0a8c0bf1b411877e07ee37f3093a341c426eaf4 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Mon, 11 Aug 2025 02:25:39 +0200 Subject: [PATCH] AddFileDependencies, MacroAddFileDependencies: Update documentation - Extended the deprecation notice. - Synced modules descriptions with other similar modules. - Added info about the MacroAddFileDependencies deprecation in the 3.14 release notes. --- Help/release/3.14.rst | 3 +++ Modules/AddFileDependencies.cmake | 30 +++++++++++++++-------- Modules/MacroAddFileDependencies.cmake | 34 ++++++++++++++++++-------- 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/Help/release/3.14.rst b/Help/release/3.14.rst index 6b3a187480..8701474df3 100644 --- a/Help/release/3.14.rst +++ b/Help/release/3.14.rst @@ -346,6 +346,9 @@ Deprecated and Removed Features ``xmlrpc``. CDash is the only maintained testing dashboard for CTest, and it only supports submissions over ``http`` and ``https``. +* The :module:`MacroAddFileDependencies` module is deprecated. + Port projects to use :command:`set_property` directly. + Other Changes ============= diff --git a/Modules/AddFileDependencies.cmake b/Modules/AddFileDependencies.cmake index 13828f22a9..25a78a815f 100644 --- a/Modules/AddFileDependencies.cmake +++ b/Modules/AddFileDependencies.cmake @@ -6,28 +6,38 @@ AddFileDependencies ------------------- .. deprecated:: 3.20 + Do not use this module in new code. -Add dependencies to a source file. + Instead use the :command:`set_property` command to append to the + :prop_sf:`OBJECT_DEPENDS` source file property directly: + + .. code-block:: cmake + + set_property(SOURCE APPEND PROPERTY OBJECT_DEPENDS ...) + +Load this module in a CMake project with: .. code-block:: cmake - add_file_dependencies( ...) + include(AddFileDependencies) -Adds the given ```` to the dependencies of file ````. +Commands +^^^^^^^^ -Do not use this command in new code. It is just a wrapper around: +This module provides the following command: -.. code-block:: cmake +.. command:: add_file_dependencies - set_property(SOURCE APPEND PROPERTY OBJECT_DEPENDS ...) + Adds dependencies to a source file: -Instead use the :command:`set_property` command to append to the -:prop_sf:`OBJECT_DEPENDS` source file property directly. + .. code-block:: cmake + add_file_dependencies( ...) + + This command adds the given ```` to the dependencies of file + ````. #]=======================================================================] function(add_file_dependencies _file) - set_property(SOURCE "${_file}" APPEND PROPERTY OBJECT_DEPENDS "${ARGN}") - endfunction() diff --git a/Modules/MacroAddFileDependencies.cmake b/Modules/MacroAddFileDependencies.cmake index 9dee09d3ed..0c65c4652a 100644 --- a/Modules/MacroAddFileDependencies.cmake +++ b/Modules/MacroAddFileDependencies.cmake @@ -6,24 +6,38 @@ MacroAddFileDependencies ------------------------ .. deprecated:: 3.14 + Do not use this module in new code. + + Instead use the :command:`set_property` command to append to the + :prop_sf:`OBJECT_DEPENDS` source file property directly: + + .. code-block:: cmake + + set_property(SOURCE APPEND PROPERTY OBJECT_DEPENDS ...) + +Load this module in a CMake project with: .. code-block:: cmake - macro_add_file_dependencies( ...) + include(MacroAddFileDependencies) -Do not use this command in new code. It is just a wrapper around: +Commands +^^^^^^^^ -.. code-block:: cmake +This module provides the following command: - set_property(SOURCE APPEND PROPERTY OBJECT_DEPENDS ...) +.. command:: macro_add_file_dependencies -Instead use the :command:`set_property` command to append to the -:prop_sf:`OBJECT_DEPENDS` source file property directly. + Adds dependencies to a source file: + .. code-block:: cmake + + macro_add_file_dependencies( ...) + + This command adds the given ```` to the dependencies of file + ````. #]=======================================================================] -macro (MACRO_ADD_FILE_DEPENDENCIES _file) - +macro(MACRO_ADD_FILE_DEPENDENCIES _file) set_property(SOURCE "${_file}" APPEND PROPERTY OBJECT_DEPENDS "${ARGN}") - -endmacro () +endmacro()