summaryrefslogtreecommitdiffstats
path: root/Help/command
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2018-03-22 19:24:41 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-03-22 19:24:49 (GMT)
commit82df2fe17e81fa4efa9717ec9d83d2915d56aa33 (patch)
treec2d28d7e62d15ed1052fc1f4f2c20a7300190bf6 /Help/command
parent8aec07e0576a6121174a210dd3e3440a9f7105aa (diff)
parent45408b5ea1e3654b5d4f6289ca1a0b5c0f1ac4e9 (diff)
downloadCMake-82df2fe17e81fa4efa9717ec9d83d2915d56aa33.zip
CMake-82df2fe17e81fa4efa9717ec9d83d2915d56aa33.tar.gz
CMake-82df2fe17e81fa4efa9717ec9d83d2915d56aa33.tar.bz2
Merge topic 'policy-version-range'
45408b5ea1 cmake_minimum_required: Optionally set policies with version range 6a41aa2abd cmPolicies: Split parsing and impl of ApplyPolicyVersion 1d00ed7cf7 cmPolicies: Drop unnecessary check from ApplyPolicyVersion 0df559832b cmPolicies: Pass policy version as std::string Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1864
Diffstat (limited to 'Help/command')
-rw-r--r--Help/command/cmake_minimum_required.rst34
-rw-r--r--Help/command/cmake_policy.rst21
2 files changed, 33 insertions, 22 deletions
diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst
index 9535bf3..7c02190 100644
--- a/Help/command/cmake_minimum_required.rst
+++ b/Help/command/cmake_minimum_required.rst
@@ -4,11 +4,15 @@ cmake_minimum_required
Set the minimum required version of cmake for a project and
update `Policy Settings`_ to match the version given::
- cmake_minimum_required(VERSION major.minor[.patch[.tweak]]
- [FATAL_ERROR])
+ cmake_minimum_required(VERSION <min>[...<max>] [FATAL_ERROR])
-If the current version of CMake is lower than that required it will
-stop processing the project and report an error.
+``<min>`` and the optional ``<max>`` are each CMake versions of the 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 ``<max>`` version, if specified, must be at least the
+``<min>`` version and affects policy settings as described below.
The ``FATAL_ERROR`` option is accepted but ignored by CMake 2.6 and
higher. It should be specified so CMake versions 2.4 and lower fail
@@ -30,21 +34,23 @@ Policy Settings
The ``cmake_minimum_required(VERSION)`` command implicitly invokes the
:command:`cmake_policy(VERSION)` command to specify that the current
-project code is written for the given version of CMake.
-All policies introduced in the specified version or earlier will be
-set to use NEW behavior. All policies introduced after the specified
-version will be unset. This effectively requests behavior preferred
+project 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. This effectively requests behavior preferred
as of a given CMake version and tells newer CMake versions to warn
about their new policies.
-When a version higher than 2.4 is specified the command implicitly
-invokes::
+When a ``<min>`` version higher than 2.4 is specified the command
+implicitly invokes::
- cmake_policy(VERSION major[.minor[.patch[.tweak]]])
+ cmake_policy(VERSION <min>[...<max>])
-which sets the cmake policy version level to the version specified.
-When version 2.4 or lower is given the command implicitly invokes::
+which sets CMake policies based on the range of versions specified.
+When a ``<min>`` version 2.4 or lower is given the command implicitly
+invokes::
- cmake_policy(VERSION 2.4)
+ cmake_policy(VERSION 2.4[...<max>])
which enables compatibility features for CMake 2.4 and lower.
diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst
index b51b951..6a8dd62 100644
--- a/Help/command/cmake_policy.rst
+++ b/Help/command/cmake_policy.rst
@@ -24,17 +24,22 @@ 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::
- cmake_policy(VERSION major.minor[.patch[.tweak]])
-
-Specify that the current CMake code is written for the given
-version of CMake. All policies introduced in the specified version or
-earlier will be set to use ``NEW`` behavior. All policies introduced
-after the specified version will be unset (unless the
+ cmake_policy(VERSION <min>[...<max>])
+
+``<min>`` and the optional ``<max>`` are each CMake versions of the form
+``major.minor[.patch[.tweak]]``, and the ``...`` is literal. The ``<min>``
+version must be at least ``2.4`` and at most the running version of CMake.
+The ``<max>`` version, if specified, must be at least the ``<min>`` version
+but may exceed the running version of CMake.
+
+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.
-The policy version specified must be at least 2.4 or the command will
-report an error.
Note that the :command:`cmake_minimum_required(VERSION)`
command implicitly calls ``cmake_policy(VERSION)`` too.