[Cmake-commits] CMake branch, next, updated. v3.7.1-1488-gf4d8b9d

Brad King brad.king at kitware.com
Fri Dec 2 11:23:24 EST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  f4d8b9d6db329e27d4bdcf07859649bb43fe7214 (commit)
       via  97c1e569245f655b5701c0b5b38bc1daa19f1750 (commit)
       via  85c8e652b10f35969dee9ada0784ca70c0f8719c (commit)
       via  8084f7a6c9d5ed6059d37abde2c5e4a68cb01157 (commit)
       via  24e29d4190e5ec87021cc11e7bc787b7245bb50b (commit)
       via  ae1a6815b6e2c0a45df51e994b75f9005e1794fe (commit)
       via  684e4d205d64ff8b98c00a1d6a358bffbf509c62 (commit)
      from  e2dae6b0f987e47f7bcdd5c0d7e4f5e97ad51703 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4d8b9d6db329e27d4bdcf07859649bb43fe7214
commit f4d8b9d6db329e27d4bdcf07859649bb43fe7214
Merge: e2dae6b 97c1e56
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Dec 2 11:23:22 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Dec 2 11:23:22 2016 -0500

    Merge topic 'features-c++17' into next
    
    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


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=97c1e569245f655b5701c0b5b38bc1daa19f1750
commit 97c1e569245f655b5701c0b5b38bc1daa19f1750
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 30 15:28:10 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Dec 2 11:22:47 2016 -0500

    Help: Add release note for C++ 17 support
    
    Closes: #16468

diff --git a/Help/release/dev/features-c++17.rst b/Help/release/dev/features-c++17.rst
new file mode 100644
index 0000000..9c28ddf
--- /dev/null
+++ b/Help/release/dev/features-c++17.rst
@@ -0,0 +1,6 @@
+features-c++17
+--------------
+
+* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
+  is now aware of C++ 17.  No specific features are yet enumerated besides
+  the ``cxx_std_17`` meta-feature.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85c8e652b10f35969dee9ada0784ca70c0f8719c
commit 85c8e652b10f35969dee9ada0784ca70c0f8719c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 30 15:26:35 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Dec 2 11:22:47 2016 -0500

    Features: Activate C++ 17 support for AppleClang 6.1+

diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index afb9aff..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,6 +43,9 @@ endif()
 macro(cmake_record_cxx_compile_features)
   set(_result 0)
   if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
+    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()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8084f7a6c9d5ed6059d37abde2c5e4a68cb01157
commit 8084f7a6c9d5ed6059d37abde2c5e4a68cb01157
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 30 15:26:19 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Dec 2 11:22:46 2016 -0500

    Features: Activate C++ 17 support for Clang 3.5+

diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 5ac43a3..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,6 +51,9 @@ endif()
 macro(cmake_record_cxx_compile_features)
   set(_result 0)
   if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.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()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=24e29d4190e5ec87021cc11e7bc787b7245bb50b
commit 24e29d4190e5ec87021cc11e7bc787b7245bb50b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 30 15:25:39 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Dec 2 11:22:46 2016 -0500

    Features: Activate C++ 17 support for GNU 5.1+

diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 4150d94..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)
@@ -49,6 +54,9 @@ endif()
 macro(cmake_record_cxx_compile_features)
   set(_result 0)
   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()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae1a6815b6e2c0a45df51e994b75f9005e1794fe
commit ae1a6815b6e2c0a45df51e994b75f9005e1794fe
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 30 15:25:01 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Dec 2 11:22:46 2016 -0500

    Features: Add infrastructure for C++ 17 language standard
    
    Issue: #16468

diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst
index 00a5104..2ad8157 100644
--- a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst
+++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst
@@ -23,6 +23,9 @@ The features known to this version of CMake are:
 ``cxx_std_14``
   Compiler mode is aware of C++ 14.
 
+``cxx_std_17``
+  Compiler mode is aware of C++ 17.
+
 ``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 5b186c1..30a612d 100644
--- a/Help/prop_tgt/CXX_STANDARD.rst
+++ b/Help/prop_tgt/CXX_STANDARD.rst
@@ -8,7 +8,7 @@ to build this target.  For some compilers, this results in adding a
 flag such as ``-std=gnu++11`` to the compile line.  For compilers that
 have no notion of a standard level, such as MSVC, this has no effect.
 
-Supported values are ``98``, ``11`` and ``14``.
+Supported values are ``98``, ``11``, ``14``, and ``17``.
 
 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 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/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/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 46e49dc..ead1e72 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1470,6 +1470,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
   static std::map<std::string, std::vector<std::string> > langStdMap;
   if (langStdMap.empty()) {
     // Maintain sorted order, most recent first.
+    langStdMap["CXX"].push_back("17");
     langStdMap["CXX"].push_back("14");
     langStdMap["CXX"].push_back("11");
     langStdMap["CXX"].push_back("98");
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index fecc983..ed0f73b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4064,7 +4064,7 @@ static const char* const CXX_FEATURES[] = { CM_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" };
+static const char* const CXX_STANDARDS[] = { "98", "11", "14", "17" };
 
 bool cmMakefile::AddRequiredTargetFeature(cmTarget* target,
                                           const std::string& feature,
@@ -4297,7 +4297,9 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
   bool needCxx98 = false;
   bool needCxx11 = false;
   bool needCxx14 = false;
-  this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14);
+  bool needCxx17 = false;
+  this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14,
+                               needCxx17);
 
   const char* existingCxxStandard = target->GetProperty("CXX_STANDARD");
   if (!existingCxxStandard) {
@@ -4336,7 +4338,7 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
 
 void cmMakefile::CheckNeededCxxLanguage(const std::string& feature,
                                         bool& needCxx98, bool& needCxx11,
-                                        bool& needCxx14) const
+                                        bool& needCxx14, bool& needCxx17) const
 {
   if (const char* propCxx98 =
         this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES")) {
@@ -4356,6 +4358,12 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature,
     cmSystemTools::ExpandListArgument(propCxx14, props);
     needCxx14 = std::find(props.begin(), props.end(), feature) != props.end();
   }
+  if (const char* propCxx17 =
+        this->GetDefinition("CMAKE_CXX17_COMPILE_FEATURES")) {
+    std::vector<std::string> props;
+    cmSystemTools::ExpandListArgument(propCxx17, props);
+    needCxx17 = std::find(props.begin(), props.end(), feature) != props.end();
+  }
 }
 
 bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
@@ -4365,8 +4373,10 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
   bool needCxx98 = false;
   bool needCxx11 = false;
   bool needCxx14 = false;
+  bool needCxx17 = false;
 
-  this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14);
+  this->CheckNeededCxxLanguage(feature, needCxx98, needCxx11, needCxx14,
+                               needCxx17);
 
   const char* existingCxxStandard = target->GetProperty("CXX_STANDARD");
   if (existingCxxStandard) {
@@ -4393,11 +4403,17 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
   bool setCxx98 = needCxx98 && !existingCxxStandard;
   bool setCxx11 = needCxx11 && !existingCxxStandard;
   bool setCxx14 = needCxx14 && !existingCxxStandard;
+  bool setCxx17 = needCxx17 && !existingCxxStandard;
 
-  if (needCxx14 && existingCxxStandard &&
+  if (needCxx17 && existingCxxStandard &&
       existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
                                    cmArrayEnd(CXX_STANDARDS),
-                                   cmStrCmp("14"))) {
+                                   cmStrCmp("17"))) {
+    setCxx17 = true;
+  } else if (needCxx14 && existingCxxStandard &&
+             existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
+                                          cmArrayEnd(CXX_STANDARDS),
+                                          cmStrCmp("14"))) {
     setCxx14 = true;
   } else if (needCxx11 && existingCxxStandard &&
              existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
@@ -4411,7 +4427,10 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
     setCxx98 = true;
   }
 
-  if (setCxx14) {
+  if (setCxx17) {
+    target->SetProperty("CXX_STANDARD", "17");
+    target->SetProperty("CUDA_STANDARD", "17");
+  } else if (setCxx14) {
     target->SetProperty("CXX_STANDARD", "14");
     target->SetProperty("CUDA_STANDARD", "14");
   } else if (setCxx11) {
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 859b3c8..3484e5a 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -905,7 +905,8 @@ private:
   void CheckNeededCLanguage(const std::string& feature, bool& needC90,
                             bool& needC99, bool& needC11) const;
   void CheckNeededCxxLanguage(const std::string& feature, bool& needCxx98,
-                              bool& needCxx11, bool& needCxx14) const;
+                              bool& needCxx11, bool& needCxx14,
+                              bool& needCxx17) const;
 
   bool HaveCStandardAvailable(cmTarget const* target,
                               const std::string& feature) const;
diff --git a/Source/cmake.h b/Source/cmake.h
index 0f1891d..5347745 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -549,6 +549,7 @@ private:
   F(cxx_std_98)                                                               \
   F(cxx_std_11)                                                               \
   F(cxx_std_14)                                                               \
+  F(cxx_std_17)                                                               \
   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 8acdd93..0405def 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -28,7 +28,7 @@ foreach(feature ${c_features})
   run_test(${feature} C)
 endforeach()
 get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
-list(REMOVE_ITEM cxx_features cxx_std_98 cxx_std_11 cxx_std_14)
+list(REMOVE_ITEM cxx_features cxx_std_98 cxx_std_11 cxx_std_14 cxx_std_17)
 foreach(feature ${cxx_features})
   run_test(${feature} CXX)
 endforeach()
@@ -268,6 +268,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_CXX17=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},17>
         DEFAULT_CXX14=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},14>
         DEFAULT_CXX11=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},11>
         DEFAULT_CXX98=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},98>
diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp
index 0efaefa..9b65b42 100644
--- a/Tests/CompileFeatures/default_dialect.cpp
+++ b/Tests/CompileFeatures/default_dialect.cpp
@@ -2,7 +2,11 @@
 template <long l>
 struct Outputter;
 
-#if DEFAULT_CXX14
+#if DEFAULT_CXX17
+#if __cplusplus <= 201402L
+Outputter<__cplusplus> o;
+#endif
+#elif DEFAULT_CXX14
 #if __cplusplus != 201402L
 Outputter<__cplusplus> o;
 #endif

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=684e4d205d64ff8b98c00a1d6a358bffbf509c62
commit 684e4d205d64ff8b98c00a1d6a358bffbf509c62
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 30 15:15:05 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Dec 2 11:22:43 2016 -0500

    Features: Make feature recording conditions more consistent
    
    Condition all calls to `_record_compiler_features_{c,cxx}` on
    `_result EQUAL 0` so that adding new language standards later does
    not need to update them.  Avoid some duplicate compiler version
    checks by conditioning C11 and CXX14 feature recording on the
    existence of `CMAKE_{C11,CXX14}_STANDARD_COMPILE_OPTION` (whose
    setting already used the version check).

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..afb9aff 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -38,8 +38,7 @@ 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_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..5ac43a3 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -46,7 +46,9 @@ 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_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..4150d94 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -48,10 +48,10 @@ 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_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/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()

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list