Browse Source

Help: De-duplicate policy version documentation

Brad King 8 months ago
parent
commit
d723198539

+ 14 - 0
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, ``<min>[...<max>]``. It sets the "policy version" to:
+
+* the range's ``<max>`` version, if specified, or to
+* the ``<min>`` 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<NNNN>` 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.

+ 5 - 14
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 ``<min>`` required
 version it will stop processing the project and report an error.
 The optional ``<policy_max>`` version, if specified, must be at least the
-``<min>`` version and affects policy settings as described in `Policy Settings`_.
+``<min>`` 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
 ``...<max>`` 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 <min>[...<max>])`` implicitly invokes
 
@@ -59,16 +59,7 @@ Policy Settings
 
   cmake_policy(VERSION <min>[...<max>])
 
-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 ``<min>`` (or ``<max>``, 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<NNNN>` 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
 

+ 1 - 8
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 ``...<max>`` part being ignored and
 preserving the pre-3.12 behavior of basing policies on ``<min>``.
 
-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 ``<min>`` (or ``<max>``, 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<NNNN>` 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.