[Cmake-commits] CMake branch, next, updated. v3.1.1-2371-g5f57e82

Brad King brad.king at kitware.com
Tue Jan 27 09:04:51 EST 2015


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  5f57e8282cb1aec7d34f7ab42cdd6f1fb0fe36b7 (commit)
       via  ef8dcd30a0d2c3fd43105bdc598ced2115157cd4 (commit)
      from  a8197c1a4affcaf6021bef8323381d05d155258d (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f57e8282cb1aec7d34f7ab42cdd6f1fb0fe36b7
commit 5f57e8282cb1aec7d34f7ab42cdd6f1fb0fe36b7
Merge: a8197c1 ef8dcd3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jan 27 09:04:49 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jan 27 09:04:49 2015 -0500

    Merge topic 'feature-record-msvc' into next
    
    ef8dcd30 Features: Define meaning for no language standard default


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ef8dcd30a0d2c3fd43105bdc598ced2115157cd4
commit ef8dcd30a0d2c3fd43105bdc598ced2115157cd4
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Jan 26 16:42:36 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jan 27 09:00:28 2015 -0500

    Features: Define meaning for no language standard default
    
    Define an empty string in CMAKE_<LANG>_STANDARD_DEFAULT to mean that
    the toolchain has no notion of lanuage standard levels.  In this case
    the <LANG>_STANDARD[_REQUIRED] properties will have no effect.

diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index 88ca206..962aaeb 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -1,9 +1,5 @@
-# No version of MSVC has full conformance to C++11. Therefore the
-# __cplusplus macro always evaluates to 98 even if the compilers come with
-# C++11/14/+ features enabled.  Later we should refactor the C++ side of
-# this within CMake to allow us to specify that there are no language level
-# flags for this compiler.
-set(CMAKE_CXX_STANDARD_DEFAULT 98)
+# MSVC has no specific language level or flags to change it.
+set(CMAKE_CXX_STANDARD_DEFAULT "")
 
 macro(cmake_record_cxx_compile_features)
   record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 834f705..af4c950 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2207,6 +2207,13 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target,
     {
     return;
     }
+  const char* defaultStd
+      = this->Makefile->GetDefinition("CMAKE_" + lang + "_STANDARD_DEFAULT");
+  if (defaultStd && !*defaultStd)
+    {
+    // This compiler has no notion of language standard levels.
+    return;
+    }
   std::string stdProp = lang + "_STANDARD";
   const char *standardProp = target->GetProperty(stdProp);
   if (!standardProp)
@@ -2269,8 +2276,6 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target,
                                 std::find(stds.begin(), stds.end(), standard);
   assert(stdIt != stds.end());
 
-  const char* defaultStd
-      = this->Makefile->GetDefinition("CMAKE_" + lang + "_STANDARD_DEFAULT");
   std::vector<std::string>::const_iterator defaultStdIt;
   if (defaultStd)
     {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 87e62d7..b5ff732 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -5253,6 +5253,33 @@ bool cmMakefile::
 HaveCStandardAvailable(cmTarget const* target,
                        const std::string& feature) const
 {
+  const char* defaultCStandard =
+    this->GetDefinition("CMAKE_C_STANDARD_DEFAULT");
+  if (!defaultCStandard)
+    {
+    std::ostringstream e;
+    e << "CMAKE_C_STANDARD_DEFAULT is not set.  COMPILE_FEATURES support "
+      "not fully configured for this compiler.";
+    this->IssueMessage(cmake::INTERNAL_ERROR, e.str());
+    // Return true so the caller does not try to lookup the default standard.
+    return true;
+    }
+  if (!*defaultCStandard)
+    {
+    // This compiler has no notion of language standard levels.
+    // All features known for the language are always available.
+    return true;
+    }
+  if (std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS),
+                cmStrCmp(defaultCStandard)) == cmArrayEnd(C_STANDARDS))
+    {
+    std::ostringstream e;
+    e << "The CMAKE_C_STANDARD_DEFAULT variable contains an "
+         "invalid value: \"" << defaultCStandard << "\".";
+    this->IssueMessage(cmake::INTERNAL_ERROR, e.str());
+    return false;
+    }
+
   bool needC90 = false;
   bool needC99 = false;
   bool needC11 = false;
@@ -5262,7 +5289,7 @@ HaveCStandardAvailable(cmTarget const* target,
   const char *existingCStandard = target->GetProperty("C_STANDARD");
   if (!existingCStandard)
     {
-    existingCStandard = this->GetDefinition("CMAKE_C_STANDARD_DEFAULT");
+    existingCStandard = defaultCStandard;
     }
 
   if (std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS),
@@ -5331,6 +5358,33 @@ bool cmMakefile::IsLaterStandard(std::string const& lang,
 bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
                                          const std::string& feature) const
 {
+  const char* defaultCxxStandard =
+    this->GetDefinition("CMAKE_CXX_STANDARD_DEFAULT");
+  if (!defaultCxxStandard)
+    {
+    std::ostringstream e;
+    e << "CMAKE_CXX_STANDARD_DEFAULT is not set.  COMPILE_FEATURES support "
+      "not fully configured for this compiler.";
+    this->IssueMessage(cmake::INTERNAL_ERROR, e.str());
+    // Return true so the caller does not try to lookup the default standard.
+    return true;
+    }
+  if (!*defaultCxxStandard)
+    {
+    // This compiler has no notion of language standard levels.
+    // All features known for the language are always available.
+    return true;
+    }
+  if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
+                cmStrCmp(defaultCxxStandard)) == cmArrayEnd(CXX_STANDARDS))
+    {
+    std::ostringstream e;
+    e << "The CMAKE_CXX_STANDARD_DEFAULT variable contains an "
+         "invalid value: \"" << defaultCxxStandard << "\".";
+    this->IssueMessage(cmake::INTERNAL_ERROR, e.str());
+    return false;
+    }
+
   bool needCxx98 = false;
   bool needCxx11 = false;
   bool needCxx14 = false;
@@ -5339,7 +5393,7 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
   const char *existingCxxStandard = target->GetProperty("CXX_STANDARD");
   if (!existingCxxStandard)
     {
-    existingCxxStandard = this->GetDefinition("CMAKE_CXX_STANDARD_DEFAULT");
+    existingCxxStandard = defaultCxxStandard;
     }
 
   if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 3e2624e..3a61751 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -84,9 +84,6 @@ add_RunCMake_test(ObjectLibrary)
 add_RunCMake_test(TargetObjects)
 add_RunCMake_test(TargetSources)
 add_RunCMake_test(find_dependency)
-if(MSVC)
-  set(CompileFeatures_ARGS "-DNO_LinkImplementationFeatureCycle=1")
-endif()
 add_RunCMake_test(CompileFeatures)
 add_RunCMake_test(WriteCompilerDetectionHeader)
 if(NOT WIN32)
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index 4c04e78..efea371 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -17,6 +17,8 @@ file(READ
   "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx_features.txt"
   CXX_FEATURES
 )
+include("${RunCMake_BINARY_DIR}/generate_feature_list-build/c_standard_default.cmake")
+include("${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx_standard_default.cmake")
 
 if (NOT C_FEATURES)
   run_cmake(NoSupportedCFeatures)
@@ -27,7 +29,7 @@ if (NOT CXX_FEATURES)
   run_cmake(NoSupportedCxxFeatures)
   run_cmake(NoSupportedCxxFeaturesGenex)
 else()
-  if(NOT NO_LinkImplementationFeatureCycle)
+  if(CXX_STANDARD_DEFAULT)
     run_cmake(LinkImplementationFeatureCycle)
   endif()
   run_cmake(LinkImplementationFeatureCycleSolved)
@@ -40,17 +42,19 @@ else()
   unset(RunCMake_TEST_OPTIONS)
 endif()
 
-foreach(standard 98 11)
-  file(READ
-    "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt"
-    CXX${standard}_FLAG
-  )
-  if (CXX${standard}_FLAG STREQUAL NOTFOUND)
-    run_cmake(RequireCXX${standard})
-    run_cmake(RequireCXX${standard}Variable)
-  endif()
-  if (CXX${standard}EXT_FLAG STREQUAL NOTFOUND)
-    run_cmake(RequireCXX${standard}Ext)
-    run_cmake(RequireCXX${standard}ExtVariable)
-  endif()
-endforeach()
+if(CXX_STANDARD_DEFAULT)
+  foreach(standard 98 11)
+    file(READ
+      "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt"
+      CXX${standard}_FLAG
+    )
+    if (CXX${standard}_FLAG STREQUAL NOTFOUND)
+      run_cmake(RequireCXX${standard})
+      run_cmake(RequireCXX${standard}Variable)
+    endif()
+    if (CXX${standard}EXT_FLAG STREQUAL NOTFOUND)
+      run_cmake(RequireCXX${standard}Ext)
+      run_cmake(RequireCXX${standard}ExtVariable)
+    endif()
+  endforeach()
+endif()
diff --git a/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake
index 09e17b1..5c58052 100644
--- a/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake
+++ b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake
@@ -9,6 +9,20 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_features.txt"
   "${CMAKE_CXX_COMPILE_FEATURES}"
 )
 
+if(DEFINED CMAKE_C_STANDARD_DEFAULT)
+  set(c_standard_default_code "set(C_STANDARD_DEFAULT \"${CMAKE_C_STANDARD_DEFAULT}\")\n")
+else()
+  set(c_standard_default_code "unset(C_STANDARD_DEFAULT)\n")
+endif()
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/c_standard_default.cmake" "${c_standard_default_code}")
+
+if(DEFINED CMAKE_CXX_STANDARD_DEFAULT)
+  set(cxx_standard_default_code "set(CXX_STANDARD_DEFAULT \"${CMAKE_CXX_STANDARD_DEFAULT}\")\n")
+else()
+  set(cxx_standard_default_code "unset(CXX_STANDARD_DEFAULT)\n")
+endif()
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_standard_default.cmake" "${cxx_standard_default_code}")
+
 foreach(standard 98 11)
   set(CXX${standard}_FLAG NOTFOUND)
   if (DEFINED CMAKE_CXX${standard}_STANDARD_COMPILE_OPTION)

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

Summary of changes:
 Modules/Compiler/MSVC-CXX.cmake                    |    8 +--
 Source/cmLocalGenerator.cxx                        |    9 ++-
 Source/cmMakefile.cxx                              |   58 +++++++++++++++++++-
 Tests/RunCMake/CMakeLists.txt                      |    3 -
 Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake  |   34 +++++++-----
 .../CompileFeatures/generate_feature_list.cmake    |   14 +++++
 6 files changed, 98 insertions(+), 28 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list