CMAKE_<LANG>_EXTENSIONS_DEFAULT is effectively read-only and insufficiently documented
CMake 3.22 adds a new variable CMAKE_<LANG>_EXTENSIONS_DEFAULT
(added by !6177 (merged)). It appears to be set when the <LANG>
language is enabled (or some point during the first project()
command). If the user tries to explicitly set it on the cmake
command line, their value is discarded and CMake always sets CMAKE_<LANG>_EXTENSIONS_DEFAULT
as a non-cache variable.
That behavior makes sense, since the variable is meant to indicate "this is what the default is for this compiler", not "this is what I want the default to be if CMAKE_<LANG>_EXTENSIONS
is not set". However, the documentation doesn't really make this clear. It actually took me a while to work out what the intended purpose of CMAKE_<LANG>_EXTENSIONS_DEFAULT
was and how it was different to the existing CMAKE_<LANG>_EXTENSIONS
variable. The documentation for these two variables don't mention each other, so their distinct roles are not clear. Furthermore, neither variable's documentation nor the documentation for the <LANG>_EXTENSIONS
target property make any mention of the new CMP0128
policy also added for CMake 3.22, but it is strongly related and should be highlighted.