summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2017-05-01 16:51:31 (GMT)
committerChuck Atkins <chuck.atkins@kitware.com>2017-05-02 13:49:23 (GMT)
commitd1aa2b3f607b35dc5dbf613b2334b6d243ec2bda (patch)
treeada82b978807bfb55aa784288710f3fb279b3d1e
parent87b9d6d93f2e5e6076992cae7395647359de306d (diff)
downloadCMake-d1aa2b3f607b35dc5dbf613b2334b6d243ec2bda.zip
CMake-d1aa2b3f607b35dc5dbf613b2334b6d243ec2bda.tar.gz
CMake-d1aa2b3f607b35dc5dbf613b2334b6d243ec2bda.tar.bz2
GNU: Use common compiler macros for language standard default
-rw-r--r--Modules/Compiler/GNU-C.cmake16
-rw-r--r--Modules/Compiler/GNU-CXX.cmake12
-rw-r--r--Modules/Compiler/GNU.cmake2
3 files changed, 4 insertions, 26 deletions
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 3f02618..8090fa6 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -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)
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 2499d2f..b221c4a 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -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)
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 0a510f5..e2739a8 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -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")