summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorFeRD (Frank Dana) <ferdnyc@gmail.com>2023-09-01 11:23:34 (GMT)
committerCraig Scott <craig.scott@crascit.com>2023-09-01 11:28:40 (GMT)
commit9eecdc7ab7141e6bbd3289ed0172e942e20ace05 (patch)
tree9f3b2b7b3b1e688fa2edb4a4f0d70949fff6d728 /Help
parent4cd207b6f3b2b262cf4cc8eb46a2320906542d1e (diff)
downloadCMake-9eecdc7ab7141e6bbd3289ed0172e942e20ace05.zip
CMake-9eecdc7ab7141e6bbd3289ed0172e942e20ace05.tar.gz
CMake-9eecdc7ab7141e6bbd3289ed0172e942e20ace05.tar.bz2
Help: Use signature directive for cmake_policy()
Diffstat (limited to 'Help')
-rw-r--r--Help/command/cmake_policy.rst29
1 files changed, 15 insertions, 14 deletions
diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst
index d7880bc..dff6c3c 100644
--- a/Help/command/cmake_policy.rst
+++ b/Help/command/cmake_policy.rst
@@ -24,9 +24,8 @@ The ``cmake_policy`` command is used to set policies to ``OLD`` or ``NEW``
behavior. While setting policies individually is supported, we
encourage projects to set policies based on CMake versions:
-.. code-block:: cmake
-
- cmake_policy(VERSION <min>[...<max>])
+.. signature:: cmake_policy(VERSION <min>[...<max>])
+ :target: VERSION
.. versionadded:: 3.12
The optional ``<max>`` version.
@@ -57,10 +56,8 @@ command implicitly calls ``cmake_policy(VERSION)`` too.
Setting Policies Explicitly
^^^^^^^^^^^^^^^^^^^^^^^^^^^
-.. code-block:: cmake
-
- cmake_policy(SET CMP<NNNN> NEW)
- cmake_policy(SET CMP<NNNN> OLD)
+.. signature:: cmake_policy(SET CMP<NNNN> NEW|OLD)
+ :target: SET
Tell CMake to use the ``OLD`` or ``NEW`` behavior for a given policy.
Projects depending on the old behavior of a given policy may silence a
@@ -73,9 +70,8 @@ policy state to ``NEW``.
Checking Policy Settings
^^^^^^^^^^^^^^^^^^^^^^^^
-.. code-block:: cmake
-
- cmake_policy(GET CMP<NNNN> <variable>)
+.. signature:: cmake_policy(GET CMP<NNNN> <variable>)
+ :target: GET
Check whether a given policy is set to ``OLD`` or ``NEW`` behavior.
The output ``<variable>`` value will be ``OLD`` or ``NEW`` if the
@@ -94,15 +90,20 @@ except when invoked with the ``NO_POLICY_SCOPE`` option
The ``cmake_policy`` command provides an interface to manage custom
entries on the policy stack:
-.. code-block:: cmake
+.. signature:: cmake_policy(PUSH)
+ :target: PUSH
+
+ Create a new entry on the policy stack.
+
+.. signature:: cmake_policy(POP)
+ :target: POP
- cmake_policy(PUSH)
- cmake_policy(POP)
+ Remove the last policy stack entry created with ``cmake_policy(PUSH)``.
Each ``PUSH`` must have a matching ``POP`` to erase any changes.
This is useful to make temporary changes to policy settings.
Calls to the :command:`cmake_minimum_required(VERSION)`,
-``cmake_policy(VERSION)``, or ``cmake_policy(SET)`` commands
+:command:`cmake_policy(VERSION)`, or :command:`cmake_policy(SET)` commands
influence only the current top of the policy stack.
.. versionadded:: 3.25