|
|
@@ -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)
|