[Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-793-ga388f68

Brad King brad.king at kitware.com
Fri Feb 27 16:50:34 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  a388f6819fca8ebc130dbe9f5c6f157a08885fdd (commit)
       via  c2c3e9f3733bf0eeec63252574e76d292a86b65e (commit)
      from  149f438315bfbefd040c5381916a5c428594e701 (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=a388f6819fca8ebc130dbe9f5c6f157a08885fdd
commit a388f6819fca8ebc130dbe9f5c6f157a08885fdd
Merge: 149f438 c2c3e9f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 27 16:50:32 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Feb 27 16:50:32 2015 -0500

    Merge topic 'fix-crash-on-bad-LANG_STANDARD' into next
    
    c2c3e9f3 Diagnose invalid <LANG>_STANDARD value instead of crashing (#15426)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c2c3e9f3733bf0eeec63252574e76d292a86b65e
commit c2c3e9f3733bf0eeec63252574e76d292a86b65e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 27 16:48:39 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Feb 27 16:50:00 2015 -0500

    Diagnose invalid <LANG>_STANDARD value instead of crashing (#15426)

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7ca7684..b64383f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2270,7 +2270,14 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target,
 
   std::vector<std::string>::const_iterator stdIt =
                                 std::find(stds.begin(), stds.end(), standard);
-  assert(stdIt != stds.end());
+  if (stdIt == stds.end())
+    {
+    std::string e =
+      lang + "_STANDARD is set to invalid value '" + standard + "'";
+    this->GetGlobalGenerator()->GetCMakeInstance()
+      ->IssueMessage(cmake::FATAL_ERROR, e, target->GetBacktrace());
+    return;
+    }
 
   std::vector<std::string>::const_iterator defaultStdIt =
     std::find(stds.begin(), stds.end(), defaultStd);
diff --git a/Tests/RunCMake/CompileFeatures/NotAStandard-result.txt b/Tests/RunCMake/CompileFeatures/NotAStandard-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAStandard-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt
new file mode 100644
index 0000000..deab12f
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NotAStandard.cmake:[0-9]+ \(add_library\):
+  CXX_STANDARD is set to invalid value 'bad'
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CompileFeatures/NotAStandard.cmake b/Tests/RunCMake/CompileFeatures/NotAStandard.cmake
new file mode 100644
index 0000000..11529d8
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAStandard.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_CXX_STANDARD bad)
+add_library(somelib STATIC empty.cpp)
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index 833a315..63cb4fa 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -8,6 +8,8 @@ run_cmake(NotAFeature_OriginDebugGenex)
 run_cmake(NotAFeature_OriginDebugTransitive)
 run_cmake(NotAFeature_OriginDebugCommand)
 
+run_cmake(NotAStandard)
+
 run_cmake(generate_feature_list)
 file(READ
   "${RunCMake_BINARY_DIR}/generate_feature_list-build/c_features.txt"

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

Summary of changes:
 Source/cmLocalGenerator.cxx                                   |    9 ++++++++-
 .../NotAStandard-result.txt}                                  |    0
 Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt        |    4 ++++
 Tests/RunCMake/CompileFeatures/NotAStandard.cmake             |    2 ++
 Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake             |    2 ++
 5 files changed, 16 insertions(+), 1 deletion(-)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CompileFeatures/NotAStandard-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt
 create mode 100644 Tests/RunCMake/CompileFeatures/NotAStandard.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list