diff options
author | Brad King <brad.king@kitware.com> | 2016-12-05 15:56:32 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-12-05 15:56:32 (GMT) |
commit | 41f11259317668d53c9712afbb6cbc1580c45681 (patch) | |
tree | ba8bd87267694f449f1e6d20d9467c8e6b86eef9 /Modules | |
parent | d59010e47fa953afb7f638fbab1a65195478d3fa (diff) | |
parent | 97c1e569245f655b5701c0b5b38bc1daa19f1750 (diff) | |
download | CMake-41f11259317668d53c9712afbb6cbc1580c45681.zip CMake-41f11259317668d53c9712afbb6cbc1580c45681.tar.gz CMake-41f11259317668d53c9712afbb6cbc1580c45681.tar.bz2 |
Merge topic 'features-c++17'
97c1e569 Help: Add release note for C++ 17 support
85c8e652 Features: Activate C++ 17 support for AppleClang 6.1+
8084f7a6 Features: Activate C++ 17 support for Clang 3.5+
24e29d41 Features: Activate C++ 17 support for GNU 5.1+
ae1a6815 Features: Add infrastructure for C++ 17 language standard
684e4d20 Features: Make feature recording conditions more consistent
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeCUDACompilerId.cu.in | 4 | ||||
-rw-r--r-- | Modules/CMakeCXXCompiler.cmake.in | 1 | ||||
-rw-r--r-- | Modules/CMakeCXXCompilerId.cpp.in | 4 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompileFeatures.cmake | 6 | ||||
-rw-r--r-- | Modules/Compiler/AppleClang-C.cmake | 4 | ||||
-rw-r--r-- | Modules/Compiler/AppleClang-CXX.cmake | 11 | ||||
-rw-r--r-- | Modules/Compiler/Clang-C.cmake | 4 | ||||
-rw-r--r-- | Modules/Compiler/Clang-CXX.cmake | 12 | ||||
-rw-r--r-- | Modules/Compiler/GNU-C.cmake | 6 | ||||
-rw-r--r-- | Modules/Compiler/GNU-CXX.cmake | 14 | ||||
-rw-r--r-- | Modules/Compiler/Intel-C.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/Intel-CXX.cmake | 7 | ||||
-rw-r--r-- | Modules/Compiler/MSVC-CXX.cmake | 1 | ||||
-rw-r--r-- | Modules/Compiler/SunPro-CXX.cmake | 4 |
14 files changed, 62 insertions, 18 deletions
diff --git a/Modules/CMakeCUDACompilerId.cu.in b/Modules/CMakeCUDACompilerId.cu.in index 5fa85da..a20f1b1 100644 --- a/Modules/CMakeCUDACompilerId.cu.in +++ b/Modules/CMakeCUDACompilerId.cu.in @@ -14,7 +14,9 @@ char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; @CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@ const char* info_language_dialect_default = "INFO" ":" "dialect_default[" -#if __cplusplus >= 201402L +#if __cplusplus > 201402L + "17" +#elif __cplusplus >= 201402L "14" #elif __cplusplus >= 201103L "11" diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index c295b74..6d56488 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -8,6 +8,7 @@ set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@") set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@") set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@") set(CMAKE_CXX14_COMPILE_FEATURES "@CMAKE_CXX14_COMPILE_FEATURES@") +set(CMAKE_CXX17_COMPILE_FEATURES "@CMAKE_CXX17_COMPILE_FEATURES@") set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@") set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@") diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 3e5c0fc..9aa096d 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -28,7 +28,9 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; @CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@ const char* info_language_dialect_default = "INFO" ":" "dialect_default[" -#if __cplusplus >= 201402L +#if __cplusplus > 201402L + "17" +#elif __cplusplus >= 201402L "14" #elif __cplusplus >= 201103L "11" diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake index 5ca72cc..3ed92be 100644 --- a/Modules/CMakeDetermineCompileFeatures.cmake +++ b/Modules/CMakeDetermineCompileFeatures.cmake @@ -48,6 +48,7 @@ function(cmake_determine_compile_features lang) set(CMAKE_CXX98_COMPILE_FEATURES) set(CMAKE_CXX11_COMPILE_FEATURES) set(CMAKE_CXX14_COMPILE_FEATURES) + set(CMAKE_CXX17_COMPILE_FEATURES) include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") @@ -58,6 +59,9 @@ function(cmake_determine_compile_features lang) return() endif() + if (CMAKE_CXX14_COMPILE_FEATURES AND CMAKE_CXX17_COMPILE_FEATURES) + list(REMOVE_ITEM CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES}) + endif() if (CMAKE_CXX11_COMPILE_FEATURES AND CMAKE_CXX14_COMPILE_FEATURES) list(REMOVE_ITEM CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES}) endif() @@ -70,6 +74,7 @@ function(cmake_determine_compile_features lang) ${CMAKE_CXX98_COMPILE_FEATURES} ${CMAKE_CXX11_COMPILE_FEATURES} ${CMAKE_CXX14_COMPILE_FEATURES} + ${CMAKE_CXX17_COMPILE_FEATURES} ) endif() @@ -77,6 +82,7 @@ function(cmake_determine_compile_features lang) set(CMAKE_CXX98_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES} PARENT_SCOPE) + set(CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES} PARENT_SCOPE) message(STATUS "Detecting ${lang} compile features - done") endif() diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index fe39b3b..f874e74 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -27,7 +27,9 @@ endif() macro(cmake_record_c_compile_features) set(_result 0) if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) - _record_compiler_features_c(11) + if (_result EQUAL 0) + _record_compiler_features_c(11) + endif() if (_result EQUAL 0) _record_compiler_features_c(99) endif() diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index 8dd6278..ee900ae 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -22,6 +22,11 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1) + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z") + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") +endif() + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) if (NOT CMAKE_CXX_COMPILER_FORCED) if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) @@ -38,8 +43,10 @@ endif() macro(cmake_record_cxx_compile_features) set(_result 0) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) - set(_result 0) - if(CMAKE_CXX14_STANDARD_COMPILE_OPTION) + if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION) + _record_compiler_features_cxx(17) + endif() + if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION) _record_compiler_features_cxx(14) endif() if (_result EQUAL 0) diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index b3f3805..bcd9218 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -36,7 +36,9 @@ endif() macro(cmake_record_c_compile_features) set(_result 0) if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) - _record_compiler_features_c(11) + if (_result EQUAL 0) + _record_compiler_features_c(11) + endif() if (_result EQUAL 0) _record_compiler_features_c(99) endif() diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index dfe0628..d0e2521 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -31,6 +31,11 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z") + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") +endif() + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) if (NOT CMAKE_CXX_COMPILER_FORCED) if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) @@ -46,7 +51,12 @@ endif() macro(cmake_record_cxx_compile_features) set(_result 0) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) - _record_compiler_features_cxx(14) + if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION) + _record_compiler_features_cxx(17) + endif() + if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION) + _record_compiler_features_cxx(14) + endif() if (_result EQUAL 0) _record_compiler_features_cxx(11) endif() diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index 4dbf6ef..05c3bb2 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -41,10 +41,10 @@ endif() macro(cmake_record_c_compile_features) set(_result 0) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) - _record_compiler_features_c(11) - endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) + if(_result EQUAL 0 AND CMAKE_C11_STANDARD_COMPILE_OPTION) + _record_compiler_features_c(11) + endif() if (_result EQUAL 0) _record_compiler_features_c(99) endif() diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 936f62b..b04ea11 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -34,6 +34,11 @@ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z") + 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) @@ -48,10 +53,13 @@ endif() macro(cmake_record_cxx_compile_features) set(_result 0) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - _record_compiler_features_cxx(14) - endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) + if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION) + _record_compiler_features_cxx(17) + endif() + if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION) + _record_compiler_features_cxx(14) + endif() if (_result EQUAL 0) _record_compiler_features_cxx(11) endif() diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 5a79452..6408392 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -49,7 +49,7 @@ unset(_ext) macro(cmake_record_c_compile_features) set(_result 0) if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) + if (_result EQUAL 0 AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) _record_compiler_features_C(11) endif() if (_result EQUAL 0) diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index d01d38d..9c39236 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -66,9 +66,10 @@ unset(_ext) macro(cmake_record_cxx_compile_features) set(_result 0) if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0 - OR (NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND - NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)) + if (_result EQUAL 0 AND + (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0 + OR (NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND + NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0))) _record_compiler_features_cxx(14) endif() if (_result EQUAL 0) diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index f103832..8fcfa0f 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -10,6 +10,7 @@ macro(cmake_record_cxx_compile_features) cxx_std_98 cxx_std_11 cxx_std_14 + cxx_std_17 ) _record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES) endif() diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index e83c896..f4345b8 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -53,7 +53,9 @@ endif() macro(cmake_record_cxx_compile_features) set(_result 0) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) - _record_compiler_features_cxx(11) + if (_result EQUAL 0) + _record_compiler_features_cxx(11) + endif() if (_result EQUAL 0) _record_compiler_features_cxx(98) endif() |