### Navigation

- index
- next |
- previous |
- CMake »
- 3.2.2 Documentation »

# cmake-policies(7)

Contents

- cmake-policies(7)
  - Introduction
  - All Policies

## 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 `cmake_policy()` command. It is also possible to request `NEW`, or non-backward compatible behavior 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 `CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable.

Note that policies are not reliable feature toggles. A policy should almost never be set to `OLD`, except to silence warnings in an otherwise frozen or stable codebase, or temporarily as part of a larger migration path. The `OLD` behavior of each policy is undesirable and will be replaced with an error condition in a future release.

The `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 `NEW` behavior. To manage policies without increasing the minimum required CMake version, the `if(POLICY)` command may be used:

    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 `include()` command or the `find_package()` command contain a use of `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.

The `CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used to determine whether to report an error on use of deprecated macros or functions.

## All Policies

- CMP0000
- CMP0001
- CMP0002
- CMP0003
- CMP0004
- CMP0005
- CMP0006
- CMP0007
- CMP0008
- CMP0009
- CMP0010
- CMP0011
- CMP0012
- CMP0013
- CMP0014
- CMP0015
- CMP0016
- CMP0017
- CMP0018
- CMP0019
- CMP0020
- CMP0021
- CMP0022
- CMP0023
- CMP0024
- CMP0025
- CMP0026
- CMP0027
- CMP0028
- CMP0029
- CMP0030
- CMP0031
- CMP0032
- CMP0033
- CMP0034
- CMP0035
- CMP0036
- CMP0037
- CMP0038
- CMP0039
- CMP0040
- CMP0041
- CMP0042
- CMP0043
- CMP0044
- CMP0045
- CMP0046
- CMP0047
- CMP0048
- CMP0049
- CMP0050
- CMP0051
- CMP0052
- CMP0053
- CMP0054
- CMP0055
- CMP0056

### Navigation

- index
- next |
- previous |
- CMake »
- 3.2.2 Documentation »