2013-10-30 17:58:25 +04:00
|
|
|
.. cmake-manual-description: CMake Policies Reference
|
|
|
|
|
2013-10-15 19:17:36 +04:00
|
|
|
cmake-policies(7)
|
|
|
|
*****************
|
|
|
|
|
|
|
|
.. only:: html or latex
|
|
|
|
|
|
|
|
.. contents::
|
|
|
|
|
2013-10-18 21:22:09 +04:00
|
|
|
Introduction
|
|
|
|
============
|
|
|
|
|
|
|
|
Policies in CMake are used to preserve backward compatible behavior
|
|
|
|
across multiple releases. When a new policy is introduced, newer CMake
|
|
|
|
versions will begin to warn about the backward compatible behavior. It
|
|
|
|
is possible to disable the warning by explicitly requesting the OLD, or
|
|
|
|
backward compatible behavior using the :command:`cmake_policy` command.
|
|
|
|
It is also possible to request NEW, or non-backward compatible behavior
|
2014-01-09 17:53:38 +04:00
|
|
|
for a policy, also avoiding the warning. Each policy can also be set to
|
|
|
|
either NEW or OLD behavior explicitly on the command line with the
|
|
|
|
:variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable.
|
2013-10-18 21:22:09 +04:00
|
|
|
|
|
|
|
The :command:`cmake_minimum_required` command does more than report an
|
|
|
|
error if a too-old version of CMake is used to build a project. It
|
|
|
|
also sets all policies introduced in that CMake version or earlier to
|
2013-12-20 15:19:11 +04:00
|
|
|
NEW behavior. To manage policies without increasing the minimum required
|
2013-12-26 17:57:02 +04:00
|
|
|
CMake version, the :command:`if(POLICY)` command may be used:
|
|
|
|
|
|
|
|
.. code-block:: cmake
|
2013-12-20 15:19:11 +04:00
|
|
|
|
|
|
|
if(POLICY CMP0990)
|
|
|
|
cmake_policy(SET CMP0990 NEW)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
This has the effect of using the NEW behavior with newer CMake releases which
|
|
|
|
users may be using and not issuing a compatibility warning.
|
|
|
|
|
|
|
|
The setting of a policy is confined in some cases to not propagate to the
|
|
|
|
parent scope. For example, if the files read by the :command:`include` command
|
|
|
|
or the :command:`find_package` command contain a use of :command:`cmake_policy`,
|
|
|
|
that policy setting will not affect the caller by default. Both commands accept
|
|
|
|
an optional ``NO_POLICY_SCOPE`` keyword to control this behavior.
|
2013-10-18 21:22:09 +04:00
|
|
|
|
|
|
|
The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
|
|
|
|
to determine whether to report an error on use of deprecated macros or
|
|
|
|
functions.
|
|
|
|
|
2013-10-15 19:17:36 +04:00
|
|
|
All Policies
|
|
|
|
============
|
|
|
|
|
|
|
|
.. toctree::
|
2013-11-01 19:12:02 +04:00
|
|
|
:maxdepth: 1
|
|
|
|
|
2013-10-15 19:17:36 +04:00
|
|
|
/policy/CMP0000
|
|
|
|
/policy/CMP0001
|
|
|
|
/policy/CMP0002
|
|
|
|
/policy/CMP0003
|
|
|
|
/policy/CMP0004
|
|
|
|
/policy/CMP0005
|
|
|
|
/policy/CMP0006
|
|
|
|
/policy/CMP0007
|
|
|
|
/policy/CMP0008
|
|
|
|
/policy/CMP0009
|
|
|
|
/policy/CMP0010
|
|
|
|
/policy/CMP0011
|
|
|
|
/policy/CMP0012
|
|
|
|
/policy/CMP0013
|
|
|
|
/policy/CMP0014
|
|
|
|
/policy/CMP0015
|
|
|
|
/policy/CMP0016
|
|
|
|
/policy/CMP0017
|
|
|
|
/policy/CMP0018
|
|
|
|
/policy/CMP0019
|
|
|
|
/policy/CMP0020
|
|
|
|
/policy/CMP0021
|
|
|
|
/policy/CMP0022
|
|
|
|
/policy/CMP0023
|
|
|
|
/policy/CMP0024
|
|
|
|
/policy/CMP0025
|
|
|
|
/policy/CMP0026
|
2013-06-18 18:33:33 +04:00
|
|
|
/policy/CMP0027
|
2013-07-30 11:51:56 +04:00
|
|
|
/policy/CMP0028
|
2013-10-18 19:54:48 +04:00
|
|
|
/policy/CMP0029
|
2013-10-18 19:55:42 +04:00
|
|
|
/policy/CMP0030
|
2013-10-18 20:41:54 +04:00
|
|
|
/policy/CMP0031
|
2013-10-18 21:00:17 +04:00
|
|
|
/policy/CMP0032
|
2013-10-18 21:09:32 +04:00
|
|
|
/policy/CMP0033
|
2013-10-21 19:50:47 +04:00
|
|
|
/policy/CMP0034
|
2013-10-21 19:58:48 +04:00
|
|
|
/policy/CMP0035
|
2013-10-21 21:12:18 +04:00
|
|
|
/policy/CMP0036
|
2013-11-05 20:32:30 +04:00
|
|
|
/policy/CMP0037
|
2013-11-05 21:01:09 +04:00
|
|
|
/policy/CMP0038
|
2013-11-05 22:15:53 +04:00
|
|
|
/policy/CMP0039
|
2013-11-20 12:53:06 +04:00
|
|
|
/policy/CMP0040
|
2013-11-26 14:24:47 +04:00
|
|
|
/policy/CMP0041
|
2013-12-19 08:25:29 +04:00
|
|
|
/policy/CMP0042
|
2013-12-30 16:33:02 +04:00
|
|
|
/policy/CMP0043
|
2013-12-26 18:59:55 +04:00
|
|
|
/policy/CMP0044
|
2014-01-08 16:16:33 +04:00
|
|
|
/policy/CMP0045
|