From d723198539ea9881c42d928fae3cc759aee1d03e Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 13 Feb 2025 12:29:38 -0500 Subject: Help: De-duplicate policy version documentation --- Help/command/POLICY_VERSION.txt | 14 ++++++++++++++ Help/command/cmake_minimum_required.rst | 19 +++++-------------- Help/command/cmake_policy.rst | 9 +-------- 3 files changed, 20 insertions(+), 22 deletions(-) create mode 100644 Help/command/POLICY_VERSION.txt diff --git a/Help/command/POLICY_VERSION.txt b/Help/command/POLICY_VERSION.txt new file mode 100644 index 0000000..9ac998c --- /dev/null +++ b/Help/command/POLICY_VERSION.txt @@ -0,0 +1,14 @@ +This specifies that the current CMake code is written for the given range of +CMake versions, ``[...]``. It sets the "policy version" to: + +* the range's ```` version, if specified, or to +* the ```` version. + +The policy version effectively requests behavior preferred as of a given CMake +version and tells newer CMake versions to warn about their new policies. +All policies known to the running version of CMake and introduced +in that version or earlier will be set to use ``NEW`` behavior. +All policies introduced in later versions will be unset (unless the +:variable:`CMAKE_POLICY_DEFAULT_CMP` variable sets a default). +This effectively requests behavior preferred as of a given CMake +version and tells newer CMake versions to warn about their new policies. diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index d671008..47e8e6b 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -19,7 +19,7 @@ form ``major.minor[.patch[.tweak]]``, and the ``...`` is literal. If the running version of CMake is lower than the ```` required version it will stop processing the project and report an error. The optional ```` version, if specified, must be at least the -```` version and affects policy settings as described in `Policy Settings`_. +```` version and sets the `Policy Version`_. If the running version of CMake is older than 3.12, the extra ``...`` dots will be seen as version component separators, resulting in the ``...`` part being ignored and preserving the pre-3.12 behavior @@ -48,10 +48,10 @@ with an error instead of just a warning. calling scope, calling ``cmake_minimum_required()`` inside a function is generally discouraged. -.. _`Policy Settings`: +.. _`Policy Version`: -Policy Settings -^^^^^^^^^^^^^^^ +Policy Version +^^^^^^^^^^^^^^ ``cmake_minimum_required(VERSION [...])`` implicitly invokes @@ -59,16 +59,7 @@ Policy Settings cmake_policy(VERSION [...]) -This specifies that the current CMake code is written for the given -range of CMake versions. - -All policies known to the running version of CMake and introduced -in the ```` (or ````, if specified) version or earlier will -be set to use ``NEW`` behavior. All policies introduced in later -versions will be unset (unless the -:variable:`CMAKE_POLICY_DEFAULT_CMP` variable sets a default). -This effectively requests behavior preferred as of a given CMake -version and tells newer CMake versions to warn about their new policies. +.. include:: POLICY_VERSION.txt .. include:: DEPRECATED_POLICY_VERSIONS.txt diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst index 4a08c01..276e160 100644 --- a/Help/command/cmake_policy.rst +++ b/Help/command/cmake_policy.rst @@ -39,14 +39,7 @@ CMake is older than 3.12, the extra ``...`` dots will be seen as version component separators, resulting in the ``...`` part being ignored and preserving the pre-3.12 behavior of basing policies on ````. -This specifies that the current CMake code is written for the given -range of CMake versions. All policies known to the running version of CMake -and introduced in the ```` (or ````, if specified) version -or earlier will be set to use ``NEW`` behavior. All policies -introduced in later versions will be unset (unless the -:variable:`CMAKE_POLICY_DEFAULT_CMP` variable sets a default). -This effectively requests behavior preferred as of a given CMake -version and tells newer CMake versions to warn about their new policies. +.. include:: POLICY_VERSION.txt Note that the :command:`cmake_minimum_required(VERSION)` command implicitly calls ``cmake_policy(VERSION)`` too. -- cgit v0.12