summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2021-05-29 15:34:18 (GMT)
committerRaul Tambre <raul@tambre.ee>2021-09-29 19:28:40 (GMT)
commit4a0485be7f4ab06201c478f5a46111ab1e8e773e (patch)
treea4a89916f051e70a7fac32fbba0daaefbcc4ac0d /Modules
parent29e2b8517126389b2c4b2f3479c4634a8260bea3 (diff)
downloadCMake-4a0485be7f4ab06201c478f5a46111ab1e8e773e.zip
CMake-4a0485be7f4ab06201c478f5a46111ab1e8e773e.tar.gz
CMake-4a0485be7f4ab06201c478f5a46111ab1e8e773e.tar.bz2
cmStandardLevelResolver: Avoid unnecessary flags, fix unset level logic
The changes are part of CMP0128. When the standard level is unset: * Flags are added if extension mode doesn't match the compiler's default. Previously logic only worked if LANG_EXTENSIONS was ON. Fixes #22224. * The full flag is used. Previously CMAKE_LANG_EXTENSION_COMPILE_OPTION was used. This was only supported for IAR. Otherwise: * Avoid adding flags if not necessary per the detected compiler defaults. * Fixed check for when the requested standard is older. It now matches the nearby comments. I reworded the fallback comment as its logic was a bit difficult to wrap my head around.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Compiler/IAR-C.cmake1
-rw-r--r--Modules/Compiler/IAR-CXX.cmake2
2 files changed, 2 insertions, 1 deletions
diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake
index 9629279..0ef1a2a 100644
--- a/Modules/Compiler/IAR-C.cmake
+++ b/Modules/Compiler/IAR-C.cmake
@@ -14,6 +14,7 @@ if(NOT DEFINED CMAKE_C_COMPILER_VERSION)
message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.")
endif()
+# Unused after CMP0128
set(CMAKE_C_EXTENSION_COMPILE_OPTION -e)
if(CMAKE_C_COMPILER_VERSION_INTERNAL VERSION_GREATER 7)
diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake
index b102aa6..a3f1dbc 100644
--- a/Modules/Compiler/IAR-CXX.cmake
+++ b/Modules/Compiler/IAR-CXX.cmake
@@ -27,7 +27,7 @@ if(NOT CMAKE_IAR_CXX_FLAG)
endif()
set(CMAKE_CXX_STANDARD_COMPILE_OPTION "")
-set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e)
+set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e) # Unused after CMP0128
set(CMAKE_CXX${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}_EXTENSION_COMPILE_OPTION -e)