summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Compiler')
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake18
-rw-r--r--Modules/Compiler/IAR-C.cmake1
-rw-r--r--Modules/Compiler/IAR-CXX.cmake2
3 files changed, 14 insertions, 7 deletions
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
index c86af98..2f220d4 100644
--- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -38,20 +38,26 @@ macro(__compiler_check_default_language_standard lang stdver1 std1)
# support for language standards, then don't bother.
if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL "${stdver1}")
if (NOT CMAKE_${lang}_COMPILER_FORCED)
- if (NOT CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT)
- message(FATAL_ERROR "CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_${lang}_COMPILER_ID} (${CMAKE_${lang}_COMPILER}) version ${CMAKE_${lang}_COMPILER_VERSION}")
+ if (NOT CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT OR NOT DEFINED CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT)
+ message(FATAL_ERROR "CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT and CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT should be set for ${CMAKE_${lang}_COMPILER_ID} (${CMAKE_${lang}_COMPILER}) version ${CMAKE_${lang}_COMPILER_VERSION}")
endif ()
set(CMAKE_${lang}_STANDARD_DEFAULT ${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT})
+ set(CMAKE_${lang}_EXTENSIONS_DEFAULT ${CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT})
else ()
list(REVERSE __std_ver_pairs)
foreach (__std_ver_pair IN LISTS __std_ver_pairs)
string(REGEX MATCH "([^ ]+) (.+)" __std_ver_pair "${__std_ver_pair}")
set(__stdver ${CMAKE_MATCH_1})
set(__std ${CMAKE_MATCH_2})
- if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL __stdver AND
- NOT DEFINED CMAKE_${lang}_STANDARD_DEFAULT)
- # Compiler id was forced so just guess the default standard level.
- set(CMAKE_${lang}_STANDARD_DEFAULT ${__std})
+ # Compiler id was forced so just guess the defaults.
+ if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL __stdver)
+ if(NOT DEFINED CMAKE_${lang}_EXTENSIONS_DEFAULT)
+ # Currently known compilers default to enabling extensions.
+ set(CMAKE_${lang}_EXTENSIONS_DEFAULT ON)
+ endif()
+ if(NOT DEFINED CMAKE_${lang}_STANDARD_DEFAULT)
+ set(CMAKE_${lang}_STANDARD_DEFAULT ${__std})
+ endif()
endif ()
unset(__std)
unset(__stdver)
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)