diff options
author | Brad King <brad.king@kitware.com> | 2018-03-16 16:42:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-03-21 12:00:28 (GMT) |
commit | 45408b5ea1e3654b5d4f6289ca1a0b5c0f1ac4e9 (patch) | |
tree | 73dd09488de4a0559bd3e3dd1828f8c75278f31c /Help/command/cmake_policy.rst | |
parent | 6a41aa2abd75ceaa9081edc1c7f8510d2c17dd7e (diff) | |
download | CMake-45408b5ea1e3654b5d4f6289ca1a0b5c0f1ac4e9.zip CMake-45408b5ea1e3654b5d4f6289ca1a0b5c0f1ac4e9.tar.gz CMake-45408b5ea1e3654b5d4f6289ca1a0b5c0f1ac4e9.tar.bz2 |
cmake_minimum_required: Optionally set policies with version range
Teach `cmake_minimum_required` and `cmake_policy(VERSION)` to support a
version range of the form `<min>[...<max>]`. Define this to mean that
version `<min>` is required, but known policies up to those introduced
by `<max>` will be set to `NEW`. This will allow projects to easily
specify a range of versions for which they have been updated.
Diffstat (limited to 'Help/command/cmake_policy.rst')
-rw-r--r-- | Help/command/cmake_policy.rst | 21 |
1 files changed, 13 insertions, 8 deletions
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. |