From 0bc3e5788a669f16383a586fee4684e9a08488dc Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 26 Mar 2018 14:21:41 -0400 Subject: Features: Use -std=c++17 for C++ 17 on GNU 8.0+ GNU 8 now documents official support for the `-std=c++17` flag. --- Modules/Compiler/GNU-CXX.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 4f1f30e..0b15d25 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -33,7 +33,10 @@ 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) +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") +elseif (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() -- cgit v0.12 From 1b328e09a33e61293635c7ddb9bcff986ae8d1e7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 26 Mar 2018 14:22:52 -0400 Subject: Features: Use -std=c++17 for C++ 17 on Clang 5.0+ Clang 5.0 added support for the `-std=c++17` flag. --- Modules/Compiler/Clang-CXX.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index efc68b3..8a7d64a 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -32,7 +32,10 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") + elseif (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() -- cgit v0.12 From 7fe580a36253281784dda9c35798693350e24859 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 26 Mar 2018 11:55:15 -0400 Subject: Features: Add infrastructure for C++ 20 language standard Issue: #17849 --- Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst | 3 +++ Help/prop_tgt/CXX_STANDARD.rst | 2 +- Modules/CMakeCUDACompilerId.cu.in | 4 +++- Modules/CMakeCXXCompiler.cmake.in | 1 + Modules/CMakeCXXCompilerId.cpp.in | 4 +++- Modules/CMakeDetermineCompileFeatures.cmake | 6 ++++++ Modules/Compiler/CMakeCommonCompilerMacros.cmake | 3 +++ Modules/Compiler/Clang-CXX.cmake | 2 ++ Modules/Compiler/MSVC-CXX.cmake | 9 +++++++++ Source/cmLocalGenerator.cxx | 1 + Source/cmMakefile.cxx | 23 +++++++++++++++++------ Source/cmMakefile.h | 2 +- Source/cmake.h | 1 + Tests/CompileFeatures/CMakeLists.txt | 2 ++ Tests/CompileFeatures/default_dialect.cpp | 6 +++++- 15 files changed, 58 insertions(+), 11 deletions(-) diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst index 2ad8157..262a67c 100644 --- a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst @@ -26,6 +26,9 @@ The features known to this version of CMake are: ``cxx_std_17`` Compiler mode is aware of C++ 17. +``cxx_std_20`` + Compiler mode is aware of C++ 20. + ``cxx_aggregate_default_initializers`` Aggregate default initializers, as defined in N3605_. diff --git a/Help/prop_tgt/CXX_STANDARD.rst b/Help/prop_tgt/CXX_STANDARD.rst index 0762033..ccc0147 100644 --- a/Help/prop_tgt/CXX_STANDARD.rst +++ b/Help/prop_tgt/CXX_STANDARD.rst @@ -9,7 +9,7 @@ flag such as ``-std=gnu++11`` to the compile line. For compilers that have no notion of a standard level, such as Microsoft Visual C++ before 2015 Update 3, this has no effect. -Supported values are ``98``, ``11``, ``14``, and ``17``. +Supported values are ``98``, ``11``, ``14``, ``17``, and ``20``. If the value requested does not result in a compile flag being added for the compiler in use, a previous standard flag will be added instead. This diff --git a/Modules/CMakeCUDACompilerId.cu.in b/Modules/CMakeCUDACompilerId.cu.in index 018bab7..6eda924 100644 --- a/Modules/CMakeCUDACompilerId.cu.in +++ b/Modules/CMakeCUDACompilerId.cu.in @@ -17,7 +17,9 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; @CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@ const char* info_language_dialect_default = "INFO" ":" "dialect_default[" -#if __cplusplus > 201402L +#if __cplusplus > 201703L + "20" +#elif __cplusplus >= 201703L "17" #elif __cplusplus >= 201402L "14" diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index df57a4f..974886d 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -10,6 +10,7 @@ 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_CXX20_COMPILE_FEATURES "@CMAKE_CXX20_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 4cb2267..34639b4 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -34,7 +34,9 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif const char* info_language_dialect_default = "INFO" ":" "dialect_default[" -#if CXX_STD > 201402L +#if CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L "17" #elif CXX_STD >= 201402L "14" diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake index 3ed92be..01a81a1 100644 --- a/Modules/CMakeDetermineCompileFeatures.cmake +++ b/Modules/CMakeDetermineCompileFeatures.cmake @@ -49,6 +49,7 @@ function(cmake_determine_compile_features lang) set(CMAKE_CXX11_COMPILE_FEATURES) set(CMAKE_CXX14_COMPILE_FEATURES) set(CMAKE_CXX17_COMPILE_FEATURES) + set(CMAKE_CXX20_COMPILE_FEATURES) include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") @@ -59,6 +60,9 @@ function(cmake_determine_compile_features lang) return() endif() + if (CMAKE_CXX17_COMPILE_FEATURES AND CMAKE_CXX20_COMPILE_FEATURES) + list(REMOVE_ITEM CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES}) + endif() if (CMAKE_CXX14_COMPILE_FEATURES AND CMAKE_CXX17_COMPILE_FEATURES) list(REMOVE_ITEM CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES}) endif() @@ -75,6 +79,7 @@ function(cmake_determine_compile_features lang) ${CMAKE_CXX11_COMPILE_FEATURES} ${CMAKE_CXX14_COMPILE_FEATURES} ${CMAKE_CXX17_COMPILE_FEATURES} + ${CMAKE_CXX20_COMPILE_FEATURES} ) endif() @@ -83,6 +88,7 @@ function(cmake_determine_compile_features lang) 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) + set(CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES} PARENT_SCOPE) message(STATUS "Detecting ${lang} compile features - done") endif() diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake index 684fd30..ad464c7 100644 --- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake +++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake @@ -78,6 +78,9 @@ endmacro() # Define to allow compile features to be automatically determined macro(cmake_record_cxx_compile_features) set(_result 0) + if(_result EQUAL 0 AND DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION) + _record_compiler_features_cxx(20) + endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION) _record_compiler_features_cxx(17) endif() diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 8a7d64a..8e8ab4f 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -49,6 +49,8 @@ else() set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "") set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "") endif() if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index 789fff5..6a0c5d3 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -29,6 +29,12 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND # for meta-features for C++14 and above. Override the default macro # to avoid doing unnecessary work. macro(cmake_record_cxx_compile_features) + if (DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION) + list(APPEND CMAKE_CXX20_COMPILE_FEATURES cxx_std_20) + endif() + # The main cmake_record_cxx_compile_features macro makes all + # these conditional on CMAKE_CXX##_STANDARD_COMPILE_OPTION, + # but we can skip the conditions because we set them above. list(APPEND CMAKE_CXX17_COMPILE_FEATURES cxx_std_17) list(APPEND CMAKE_CXX14_COMPILE_FEATURES cxx_std_14) list(APPEND CMAKE_CXX98_COMPILE_FEATURES cxx_std_11) # no flag needed for 11 @@ -46,6 +52,8 @@ elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "") set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "") # There is no meaningful default for this set(CMAKE_CXX_STANDARD_DEFAULT "") @@ -60,6 +68,7 @@ elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0) cxx_std_11 cxx_std_14 cxx_std_17 + cxx_std_20 ) _record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES) endmacro() diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cee540b..dde29f6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1564,6 +1564,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag( static std::map> langStdMap; if (langStdMap.empty()) { // Maintain sorted order, most recent first. + langStdMap["CXX"].push_back("20"); langStdMap["CXX"].push_back("17"); langStdMap["CXX"].push_back("14"); langStdMap["CXX"].push_back("11"); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c270629..3ecd7eb 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4223,7 +4223,7 @@ static const char* const CXX_FEATURES[] = { nullptr FOR_EACH_CXX_FEATURE( #undef FEATURE_STRING static const char* const C_STANDARDS[] = { "90", "99", "11" }; -static const char* const CXX_STANDARDS[] = { "98", "11", "14", "17" }; +static const char* const CXX_STANDARDS[] = { "98", "11", "14", "17", "20" }; bool cmMakefile::AddRequiredTargetFeature(cmTarget* target, const std::string& feature, @@ -4473,8 +4473,9 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, bool needCxx11 = false; bool needCxx14 = false; bool needCxx17 = false; + bool needCxx20 = false; this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14, - needCxx17); + needCxx17, needCxx20); const char* existingCxxStandard = target->GetProperty("CXX_STANDARD"); if (!existingCxxStandard) { @@ -4494,7 +4495,8 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, /* clang-format off */ const char* const* needCxxLevel = - needCxx17 ? &CXX_STANDARDS[3] + needCxx20 ? &CXX_STANDARDS[4] + : needCxx17 ? &CXX_STANDARDS[3] : needCxx14 ? &CXX_STANDARDS[2] : needCxx11 ? &CXX_STANDARDS[1] : needCxx98 ? &CXX_STANDARDS[0] @@ -4506,7 +4508,8 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98, bool& needCxx11, - bool& needCxx14, bool& needCxx17) const + bool& needCxx14, bool& needCxx17, + bool& needCxx20) const { if (const char* propCxx98 = this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES")) { @@ -4532,6 +4535,12 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature, cmSystemTools::ExpandListArgument(propCxx17, props); needCxx17 = std::find(props.begin(), props.end(), feature) != props.end(); } + if (const char* propCxx20 = + this->GetDefinition("CMAKE_CXX20_COMPILE_FEATURES")) { + std::vector props; + cmSystemTools::ExpandListArgument(propCxx20, props); + needCxx20 = std::find(props.begin(), props.end(), feature) != props.end(); + } } bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, @@ -4542,9 +4551,10 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, bool needCxx11 = false; bool needCxx14 = false; bool needCxx17 = false; + bool needCxx20 = false; this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14, - needCxx17); + needCxx17, needCxx20); const char* existingCxxStandard = target->GetProperty("CXX_STANDARD"); const char* const* existingCxxLevel = nullptr; @@ -4589,7 +4599,8 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, /* clang-format off */ const char* const* needCxxLevel = - needCxx17 ? &CXX_STANDARDS[3] + needCxx20 ? &CXX_STANDARDS[4] + : needCxx17 ? &CXX_STANDARDS[3] : needCxx14 ? &CXX_STANDARDS[2] : needCxx11 ? &CXX_STANDARDS[1] : needCxx98 ? &CXX_STANDARDS[0] diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 419cb6e..d2626cd 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -991,7 +991,7 @@ private: bool& needC99, bool& needC11) const; void CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98, bool& needCxx11, bool& needCxx14, - bool& needCxx17) const; + bool& needCxx17, bool& needCxx20) const; bool HaveCStandardAvailable(cmTarget const* target, const std::string& feature) const; diff --git a/Source/cmake.h b/Source/cmake.h index 1ac549b..cc56a07 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -574,6 +574,7 @@ private: F(cxx_std_11) \ F(cxx_std_14) \ F(cxx_std_17) \ + F(cxx_std_20) \ F(cxx_aggregate_default_initializers) \ F(cxx_alias_templates) \ F(cxx_alignas) \ diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index b560acd..d041bd6 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -280,6 +280,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) if (std_flag_idx EQUAL -1) add_executable(default_dialect default_dialect.cpp) target_compile_definitions(default_dialect PRIVATE + DEFAULT_CXX20=$ DEFAULT_CXX17=$ DEFAULT_CXX14=$ DEFAULT_CXX11=$ @@ -434,6 +435,7 @@ else() HAVE_CXX_STD_11=$ HAVE_CXX_STD_14=$ HAVE_CXX_STD_17=$ + HAVE_CXX_STD_20=$ ) endif() diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp index 0de1125..7ddcfe7 100644 --- a/Tests/CompileFeatures/default_dialect.cpp +++ b/Tests/CompileFeatures/default_dialect.cpp @@ -8,7 +8,11 @@ struct Outputter; #define CXX_STD __cplusplus #endif -#if DEFAULT_CXX17 +#if DEFAULT_CXX20 +#if CXX_STD <= 201703L +Outputter o; +#endif +#elif DEFAULT_CXX17 #if CXX_STD <= 201402L Outputter o; #endif -- cgit v0.12 From 8f146c45087bae5869f95cebce84134c917d28bf Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 26 Mar 2018 14:01:11 -0400 Subject: Features: Activate C++ 20 support for MSVC 19.12.25835+ --- Modules/Compiler/MSVC-CXX.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index 6a0c5d3..be259ff 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -22,6 +22,10 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++latest") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++latest") endif() + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.12.25835) + set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest") + set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++latest") + endif() __compiler_check_default_language_standard(CXX 19.0 14) -- cgit v0.12 From 71cb8ce3a1e1c41ffcd43760609defc574d2a65b Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 26 Mar 2018 14:27:12 -0400 Subject: Features: Activate C++ 20 support for GNU 8.0+ --- Modules/Compiler/GNU-CXX.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 0b15d25..0058223 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -41,4 +41,9 @@ elseif (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 8.0) + set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a") + set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a") +endif() + __compiler_check_default_language_standard(CXX 3.4 98 6.0 14) -- cgit v0.12 From 7f295b1bd3c6f4b86ebf3711fa8d76cdaf4f51a5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 26 Mar 2018 14:29:04 -0400 Subject: Features: Activate C++ 20 support for Clang 5.0+ --- Modules/Compiler/Clang-CXX.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 8e8ab4f..321ddf6 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -39,6 +39,11 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") 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 5.0) + set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a") + set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a") + endif() else() # clang-cl does not know these options because it behaves like cl.exe set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") -- cgit v0.12 From 874d3d294889b4de25cecbca4347f8012199b153 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 26 Mar 2018 14:32:06 -0400 Subject: Help: Add release note for C++ 20 support Fixes: #17849 --- Help/release/dev/features-c++20.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/features-c++20.rst diff --git a/Help/release/dev/features-c++20.rst b/Help/release/dev/features-c++20.rst new file mode 100644 index 0000000..f7d050b --- /dev/null +++ b/Help/release/dev/features-c++20.rst @@ -0,0 +1,6 @@ +features-c++20 +-------------- + +* The :manual:`Compile Features ` functionality + is now aware of C++ 20. No specific features are yet enumerated besides + the ``cxx_std_20`` meta-feature. -- cgit v0.12 From 8570dc7f64928ec7896197394f089f5ad063c6ca Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 26 Mar 2018 14:38:24 -0400 Subject: Help: Update compiler versions in cmake-compile-features.7.rst --- Help/manual/cmake-compile-features.7.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst index e9495c6..634da10 100644 --- a/Help/manual/cmake-compile-features.7.rst +++ b/Help/manual/cmake-compile-features.7.rst @@ -331,9 +331,9 @@ and :prop_gbl:`compile features ` available from the following :variable:`compiler ids _COMPILER_ID>` as of the versions specified for each: -* ``AppleClang``: Apple Clang for Xcode versions 4.4 though 6.2. -* ``Clang``: Clang compiler versions 2.9 through 3.4. -* ``GNU``: GNU compiler versions 4.4 through 5.0. +* ``AppleClang``: Apple Clang for Xcode versions 4.4 though 9.2. +* ``Clang``: Clang compiler versions 2.9 through 6.0. +* ``GNU``: GNU compiler versions 4.4 through 8.0. * ``MSVC``: Microsoft Visual Studio versions 2010 through 2017. * ``SunPro``: Oracle SolarisStudio versions 12.4 through 12.6. * ``Intel``: Intel compiler versions 12.1 through 17.0. @@ -344,7 +344,7 @@ the following :variable:`compiler ids _COMPILER_ID>` as of the versions specified for each: * all compilers and versions listed above for C++. -* ``GNU``: GNU compiler versions 3.4 through 5.0. +* ``GNU``: GNU compiler versions 3.4 through 8.0. CMake is currently aware of the :prop_tgt:`C++ standards ` and their associated meta-features (e.g. ``cxx_std_11``) available from the @@ -366,4 +366,4 @@ CMake is currently aware of the :prop_tgt:`CUDA standards ` from the following :variable:`compiler ids _COMPILER_ID>` as of the versions specified for each: -* ``NVIDIA``: NVIDIA nvcc compiler 7.5 though 8.0. +* ``NVIDIA``: NVIDIA nvcc compiler 7.5 though 9.1. -- cgit v0.12