summaryrefslogtreecommitdiffstats
path: root/Source/cmStandardLevelResolver.cxx
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2021-11-09 18:34:06 (GMT)
committerRaul Tambre <raul@tambre.ee>2021-11-11 19:55:04 (GMT)
commite47dfce75d74de26ac6ee25625a44989312e29c1 (patch)
treeb0e802226f6ac38f6f0e3992719f6807355e6577 /Source/cmStandardLevelResolver.cxx
parent2ad300ebd73c6aca7189a9f8ea8d8ad61e9c3223 (diff)
downloadCMake-e47dfce75d74de26ac6ee25625a44989312e29c1.zip
CMake-e47dfce75d74de26ac6ee25625a44989312e29c1.tar.gz
CMake-e47dfce75d74de26ac6ee25625a44989312e29c1.tar.bz2
CMP0128: Enable/disable extensions if standard same as default
This was intended to be part of the initial MR (!6177), but accidentally went missing when debugging nightly failures on less common systems. Noticed during !6711 review as the comment about this behaviour didn't match the code. Documentation for CMP0128 is updated to remove a false case and note the two cases related to this. Fixes #22224.
Diffstat (limited to 'Source/cmStandardLevelResolver.cxx')
-rw-r--r--Source/cmStandardLevelResolver.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index 957f4ca..61416e0 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -206,7 +206,8 @@ struct StandardLevelComputer
// If the standard requested is older than the compiler's default or the
// extension mode doesn't match then we need to use a flag.
- if (stdIt < defaultStdIt) {
+ if (stdIt < defaultStdIt ||
+ (cmp0128 == cmPolicies::NEW && ext != defaultExt)) {
auto offset = std::distance(cm::cbegin(stds), stdIt);
return cmStrCat("CMAKE_", this->Language, stdsStrings[offset], "_", type,
"_COMPILE_OPTION");