CMP0218 — CMake 4.4.0 Documentation

# CMP0218

Added in version 4.4.

The `CMAKE_WARN_DEPRECATED` and `CMAKE_ERROR_DEPRECATED` variables are ignored.

In CMake 4.3 and below, these variables controlled whether deprecation messages resulted in warnings, errors, or were suppressed. However, not all deprecation messages considered the non-cache values.

CMake 4.4 introduced a new, unified system for managing `diagnostics` that prefers the `cmake_diagnostic()` command for manipulating diagnostic actions.

This policy provides compatibility with projects that relied on these variables and have not been updated to be aware of the change.

The `OLD` behavior for this policy is to use the variables to control deprecation messages which respected the non-cache values of these variables in CMake 4.3 and earlier.

The `NEW` behavior does not ascribe any special meaning to the non-cache values of these variables and uses the `CMD_DEPRECATED` diagnostic state to control all deprecation messages.

Note

The `CMAKE_WARN_DEPRECATED` and `CMAKE_ERROR_DEPRECATED` cache variables are synchronized with the initial state of the `CMD_DEPRECATED` diagnostic, regardless of this policy's setting. (The synchronization happens at a point prior to when it is possible to manipulate policies.) However, this behavior is deprecated and will be removed in a future version of CMake.

Any deprecation messages introduced in CMake 4.4 or later are controlled by the `CMD_DEPRECATED` diagnostic regardless of the setting of this policy.

This policy was introduced in CMake version 4.4. It may be set by `cmake_policy()` or `cmake_minimum_required()`. If it is not set, CMake warns when either variable is accessed or modified, and uses `OLD` behavior.

Note

The `OLD` behavior of a policy is deprecated by definition and may be removed in a future version of CMake.