Added in version 3.22.
When this policy is set to NEW:
<LANG>_EXTENSIONS is initialized to CMAKE_<LANG>_EXTENSIONS if set, otherwise falling back to CMAKE_<LANG>_EXTENSIONS_DEFAULT.<LANG>_STANDARD is unset or satisfied by the default.The OLD behavior:
<LANG>_EXTENSIONS to CMAKE_<LANG>_EXTENSIONS if set, otherwise falling back to ON.<LANG>_STANDARD is set and <LANG>_STANDARD_REQUIRED is OFF.If <LANG>_STANDARD is unset:
<LANG>_EXTENSIONS is OFF.<LANG>_EXTENSIONS is ON except for the IAR compiler.Code may need to be updated for the NEW behavior in the following cases:
If a standard mode flag previously overridden by CMake's and not used during compiler detection now takes effect due to CMake no longer adding one as the default detected is appropriate.
Such code should be converted to either:
<LANG>_STANDARD and <LANG>_EXTENSIONS instead of manually adding flags.If extensions were disabled without <LANG>_STANDARD being set CMake previously wouldn't actually disable extensions.
Such code should be updated to not disable extensions if they are required.
If extensions were enabled/disabled when <LANG>_STANDARD was satisfied by the compiler's default CMake previously wouldn't actually enable/disable extensions.
Such code should be updated to set the correct extensions mode.
If compiler flags affecting the standard mode are used during compiler detection (for example in a toolchain file using CMAKE_<LANG>_FLAGS_INIT) then they will affect the detected default standard and extensions.
This policy was introduced in CMake version 3.22. It may be set by cmake_policy() or cmake_minimum_required(). If it is not set, CMake does not warn by default, and uses OLD behavior.
See documentation of the CMAKE_POLICY_WARNING_CMP0128 variable to control the warning.
Note
The OLD behavior of a policy is deprecated by definition and may be removed in a future version of CMake.
© 2000–2024 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.
https://cmake.org/cmake/help/latest/policy/CMP0128.html