CMP0231ΒΆ
Added in version 4.6.
MSVC permissive mode is controlled by CXX_EXTENSIONS.
The CXX_EXTENSIONS target property selects whether
compiler-specific language extensions are enabled.
In CMake 4.5 and below, this had no influence on MSVC permissive mode.
CMake 4.6 and above prefer to treat MSVC permissive mode as part of
the compiler extensions for C++. This policy provides compatibility
for projects that have not been updated to expect the behavior.
The OLD behavior for this policy does not add /permissive or
/permissive- for CXX_EXTENSIONS. The NEW behavior for
the MSVC compiler keeps the compiler's default permissive mode unless
the request needs a different one:
CXX_EXTENSIONSOFFadds/permissive-when the selected standard leaves the compiler permissive./std:c++98,/std:c++11,/std:c++14and/std:c++17stay permissive until this flag is passed.CXX_EXTENSIONSONadds/permissivewhen the selected standard implies/permissive-./std:c++latestimplies it since Visual Studio 2019 version 16.8, and/std:c++20and later standard modes do so as well. The flag is placed after the/std:flag so it overrides that implication.
For clang-cl 13 and above, every standard is non-permissive by default, so
CXX_EXTENSIONS ON adds -permissive and OFF adds
no flag.
No permissive flag is added when the compiler mode already matches.
Compilers older than Visual Studio 2017 and clang-cl older than 13 have
neither flag.
This policy has no effect on C or on compilers other than MSVC and
clang-cl.
This policy was introduced in CMake version 4.6.
It may be set by cmake_policy() or cmake_minimum_required().
If it is not set, CMake does not warn, 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.