Commit d1aa2b3f authored by Chuck Atkins's avatar Chuck Atkins
Browse files

GNU: Use common compiler macros for language standard default

parent 87b9d6d9
......@@ -22,21 +22,7 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
if (NOT CMAKE_C_COMPILER_FORCED)
if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
endif()
set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
# Compiler id was forced so just guess the default standard level.
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
set(CMAKE_C_STANDARD_DEFAULT 11)
else()
set(CMAKE_C_STANDARD_DEFAULT 90)
endif()
endif()
endif()
__compiler_check_default_language_standard(C 3.4 90 5.0 11)
macro(cmake_record_c_compile_features)
set(_result 0)
......
......@@ -38,17 +38,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
if (NOT CMAKE_CXX_COMPILER_FORCED)
if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
endif()
set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
# Compiler id was forced so just guess the default standard level.
set(CMAKE_CXX_STANDARD_DEFAULT 98)
endif()
endif()
__compiler_check_default_language_standard(CXX 4.4 98 6.0 14)
macro(cmake_record_cxx_compile_features)
set(_result 0)
......
......@@ -8,6 +8,8 @@ if(__COMPILER_GNU)
endif()
set(__COMPILER_GNU 1)
include(Compiler/CMakeCommonCompilerMacros)
macro(__compiler_gnu lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment