From 2b1cc175ee913477c3f1dc6978dd63b2fdaff7e2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Dec 2020 06:50:33 -0500 Subject: Help: Clarify version adding add_custom_{command,target} OUTPUT genex support Update the documentation added by commit c257c25419 (add_custom_{command,target}: Add genex support to OUTPUT and BYPRODUCTS, 2020-10-19) to use sphinx markup instead of prose to specify the version in which the feature was added. --- Help/command/add_custom_command.rst | 68 ++++++++++++++++++++----------------- Help/command/add_custom_target.rst | 5 +-- 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index 4464ad6..0b7e796 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -79,8 +79,9 @@ The options are: The :ref:`Makefile Generators` will remove ``BYPRODUCTS`` and other :prop_sf:`GENERATED` files during ``make clean``. - Since CMake 3.20, arguments to ``BYPRODUCTS`` may use - :manual:`generator expressions `. + .. versionadded:: 3.20 + Arguments to ``BYPRODUCTS`` may use + :manual:`generator expressions `. ``COMMAND`` Specify the command-line(s) to execute at build time. @@ -229,8 +230,9 @@ The options are: as a file on disk it should be marked with the :prop_sf:`SYMBOLIC` source file property. - Since CMake 3.20, arguments to ``OUTPUT`` may use - :manual:`generator expressions `. + .. versionadded:: 3.20 + Arguments to ``OUTPUT`` may use + :manual:`generator expressions `. ``USES_TERMINAL`` .. versionadded:: 3.2 @@ -291,23 +293,24 @@ adds a custom command to run ``someTool`` to generate ``out.c`` and then compile the generated source as part of a library. The generation rule will re-run whenever ``in.txt`` changes. -Since CMake 3.20, one may use generator expressions to specify -per-configuration outputs. For example, the code: +.. versionadded:: 3.20 + One may use generator expressions to specify per-configuration outputs. + For example, the code: -.. code-block:: cmake + .. code-block:: cmake - add_custom_command( - OUTPUT "out-$.c" - COMMAND someTool -i ${CMAKE_CURRENT_SOURCE_DIR}/in.txt - -o "out-$.c" - -c "$" - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/in.txt - VERBATIM) - add_library(myLib "out-$.c") + add_custom_command( + OUTPUT "out-$.c" + COMMAND someTool -i ${CMAKE_CURRENT_SOURCE_DIR}/in.txt + -o "out-$.c" + -c "$" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/in.txt + VERBATIM) + add_library(myLib "out-$.c") -adds a custom command to run ``someTool`` to generate ``out-.c``, -where ```` is the build configuration, and then compile the generated -source as part of a library. + adds a custom command to run ``someTool`` to generate ``out-.c``, + where ```` is the build configuration, and then compile the generated + source as part of a library. Build Events ^^^^^^^^^^^^ @@ -377,20 +380,21 @@ For example, the code: will run ``someHasher`` to produce a ``.hash`` file next to the executable after linking. -Since CMake 3.20, one may use generator expressions to specify -per-configuration byproducts. For example, the code: +.. versionadded:: 3.20 + One may use generator expressions to specify per-configuration byproducts. + For example, the code: -.. code-block:: cmake + .. code-block:: cmake - add_library(myPlugin MODULE myPlugin.c) - add_custom_command( - TARGET myPlugin POST_BUILD - COMMAND someHasher -i "$" - --as-code "myPlugin-hash-$.c" - BYPRODUCTS "myPlugin-hash-$.c" - VERBATIM) - add_executable(myExe myExe.c "myPlugin-hash-$.c") + add_library(myPlugin MODULE myPlugin.c) + add_custom_command( + TARGET myPlugin POST_BUILD + COMMAND someHasher -i "$" + --as-code "myPlugin-hash-$.c" + BYPRODUCTS "myPlugin-hash-$.c" + VERBATIM) + add_executable(myExe myExe.c "myPlugin-hash-$.c") -will run ``someHasher`` after linking ``myPlugin``, e.g. to produce a ``.c`` -file containing code to check the hash of ``myPlugin`` that the ``myExe`` -executable can use to verify it before loading. + will run ``someHasher`` after linking ``myPlugin``, e.g. to produce a ``.c`` + file containing code to check the hash of ``myPlugin`` that the ``myExe`` + executable can use to verify it before loading. diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst index 85e1e16..2beb519 100644 --- a/Help/command/add_custom_target.rst +++ b/Help/command/add_custom_target.rst @@ -54,8 +54,9 @@ The options are: The :ref:`Makefile Generators` will remove ``BYPRODUCTS`` and other :prop_sf:`GENERATED` files during ``make clean``. - Since CMake 3.20, arguments to ``BYPRODUCTS`` may use - :manual:`generator expressions `. + .. versionadded:: 3.20 + Arguments to ``BYPRODUCTS`` may use + :manual:`generator expressions `. ``COMMAND`` Specify the command-line(s) to execute at build time. -- cgit v0.12