Features: Populate CMAKE_<LANG>_STANDARD_DEFAULT only for supported compilers.
If no compiler feature information is known for a given compiler version, do not set a language standard default either. The two settings must be recorded consistently.
This commit is contained in:
parent
72537e4436
commit
9d767810e1
|
@ -12,7 +12,9 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
|
||||||
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
|
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD_DEFAULT 99)
|
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
|
||||||
|
set(CMAKE_C_STANDARD_DEFAULT 99)
|
||||||
|
endif()
|
||||||
|
|
||||||
macro(cmake_record_c_compile_features)
|
macro(cmake_record_c_compile_features)
|
||||||
macro(_get_appleclang_features std_version list)
|
macro(_get_appleclang_features std_version list)
|
||||||
|
|
|
@ -19,7 +19,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
|
||||||
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
|
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_DEFAULT 98)
|
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
|
||||||
|
set(CMAKE_CXX_STANDARD_DEFAULT 98)
|
||||||
|
endif()
|
||||||
|
|
||||||
macro(cmake_record_cxx_compile_features)
|
macro(cmake_record_cxx_compile_features)
|
||||||
macro(_get_appleclang_features std_version list)
|
macro(_get_appleclang_features std_version list)
|
||||||
|
|
|
@ -31,7 +31,9 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
|
||||||
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
|
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_DEFAULT 98)
|
if(UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
|
||||||
|
set(CMAKE_CXX_STANDARD_DEFAULT 98)
|
||||||
|
endif()
|
||||||
|
|
||||||
macro(cmake_record_cxx_compile_features)
|
macro(cmake_record_cxx_compile_features)
|
||||||
macro(_get_clang_features std_version list)
|
macro(_get_clang_features std_version list)
|
||||||
|
|
|
@ -24,7 +24,7 @@ endif()
|
||||||
|
|
||||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
|
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
|
||||||
set(CMAKE_C_STANDARD_DEFAULT 11)
|
set(CMAKE_C_STANDARD_DEFAULT 11)
|
||||||
else()
|
elseif(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
|
||||||
set(CMAKE_C_STANDARD_DEFAULT 90)
|
set(CMAKE_C_STANDARD_DEFAULT 90)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||||
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
|
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_DEFAULT 98)
|
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
|
||||||
|
set(CMAKE_CXX_STANDARD_DEFAULT 98)
|
||||||
|
endif()
|
||||||
|
|
||||||
macro(cmake_record_cxx_compile_features)
|
macro(cmake_record_cxx_compile_features)
|
||||||
macro(_get_gcc_features std_version list)
|
macro(_get_gcc_features std_version list)
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# MSVC has no specific language level or flags to change it.
|
|
||||||
set(CMAKE_CXX_STANDARD_DEFAULT "")
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
|
||||||
|
# MSVC has no specific language level or flags to change it.
|
||||||
|
set(CMAKE_CXX_STANDARD_DEFAULT "")
|
||||||
|
endif()
|
||||||
|
|
||||||
macro(cmake_record_cxx_compile_features)
|
macro(cmake_record_cxx_compile_features)
|
||||||
record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
|
record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
|
||||||
|
|
|
@ -37,7 +37,9 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
|
||||||
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
|
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_DEFAULT 98)
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
|
||||||
|
set(CMAKE_CXX_STANDARD_DEFAULT 98)
|
||||||
|
endif()
|
||||||
|
|
||||||
macro(cmake_record_cxx_compile_features)
|
macro(cmake_record_cxx_compile_features)
|
||||||
macro(_get_solaris_studio_features std_version list)
|
macro(_get_solaris_studio_features std_version list)
|
||||||
|
|
Loading…
Reference in New Issue