[Cmake-commits] CMake branch, next, updated. v3.2.2-2727-g00d5f20

Bill Hoffman bill.hoffman at kitware.com
Thu May 14 13:35:21 EDT 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  00d5f20395866c70ed04842685290554d97daf64 (commit)
       via  7699ce070dfdaad748f6274cd3c03efe96951c64 (commit)
      from  cb96996cfef31f71e2a9443897369cdeab79728c (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=00d5f20395866c70ed04842685290554d97daf64
commit 00d5f20395866c70ed04842685290554d97daf64
Merge: cb96996 7699ce0
Author:     Bill Hoffman <bill.hoffman at kitware.com>
AuthorDate: Thu May 14 13:35:20 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu May 14 13:35:20 2015 -0400

    Merge topic 'add-iwyu-support' into next
    
    7699ce07 Check that iwyu and compiler commands are able to run, and capture stderr.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7699ce070dfdaad748f6274cd3c03efe96951c64
commit 7699ce070dfdaad748f6274cd3c03efe96951c64
Author:     Bill Hoffman <bill.hoffman at kitware.com>
AuthorDate: Thu May 14 13:31:32 2015 -0400
Commit:     Bill Hoffman <bill.hoffman at kitware.com>
CommitDate: Thu May 14 13:31:32 2015 -0400

    Check that iwyu and compiler commands are able to run, and capture stderr.
    
    Remove iwyu match expression from cmCTestLaunch and have the -E command
    that runs iwyu add Warning to the output so that it is recognized as a
    warning.

diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index c186eeb..dcdfc48 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -285,7 +285,7 @@ endif()
 # as well as the clang compiler for building cxx files.
 if(CMAKE_IWYU_EXECUTABLE)
   set(CMAKE_CXX_COMPILE_OBJECT
-    "<CMAKE_COMMAND> -E __run_iwyu --iwyu=${CMAKE_IWYU_EXECUTABLE} -- ${CMAKE_CXX_COMPILE_OBJECT}")
+    "<CMAKE_COMMAND> -E __run_iwyu --iwyu=\"${CMAKE_IWYU_EXECUTABLE}\" -- ${CMAKE_CXX_COMPILE_OBJECT}")
 endif()
 
 
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index bf271e9..ca39f19 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -649,9 +649,6 @@ void cmCTestLaunch::LoadScrapeRules()
   this->RegexWarning.push_back("(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]");
   this->RegexWarning.push_back("(^|[ :])[Rr][Ee][Mm][Aa][Rr][Kk]");
   this->RegexWarning.push_back("(^|[ :])[Nn][Oo][Tt][Ee]");
-  // add warning expressions for include-what-you-use output
-  this->RegexWarning.push_back(".*should remove these lines:");
-  this->RegexWarning.push_back(".*should add these lines:");
   // Load custom match rules given to us by CTest.
   this->LoadScrapeRules("Warning", this->RegexWarning);
   this->LoadScrapeRules("WarningSuppress", this->RegexWarningSuppress);
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 79177fb..979e935 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -240,12 +240,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
           orig_cmd.push_back(arg);
           }
         }
-      if(cmd.size() == 0)
+      if(cmd.empty())
         {
         std::cerr << "__run_iwyu missing iwyu path --iwyu=/path/to/iwyu\n";
         return 1;
         }
-      if(orig_cmd.size() == 0)
+      if(orig_cmd.empty())
         {
         std::cerr << "__run_iwyu missing compile command after --\n";
         return 1;
@@ -253,11 +253,32 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
       std::vector<std::string> iwyucmd = orig_cmd;
       iwyucmd[0] = cmd;
       int ret = 0;
-      cmSystemTools::RunSingleCommand(iwyucmd, 0, 0, 0,
-                                      0, cmSystemTools::OUTPUT_PASSTHROUGH);
+      std::string stdErr;
+      if(!cmSystemTools::RunSingleCommand(iwyucmd, 0, &stdErr, &ret,
+                                          0, cmSystemTools::OUTPUT_NONE))
+        {
+        // if the command fails to run then output the command and
+        // the stderr from RunSingleCommand and return 1
+        std::cerr << "Error running: " << cmd << "\n";
+        std::cerr << stdErr << "\n";
+        return 1;
+        }
+      if(stdErr.find("should remove these lines:") != stdErr.npos
+        || stdErr.find("should add these lines:") != stdErr.npos)
+        {
+        std::cerr << ":Warning include what you use output: " << stdErr
+                  << "\n";
+        }
+      // capture stderr, look for strings
+      // output Warning iwyu output:\n make sure matches regex
       // the return value of iwyu is ignored as it is always fail
-      cmSystemTools::RunSingleCommand(orig_cmd, 0, 0, &ret,
-                                      0, cmSystemTools::OUTPUT_PASSTHROUGH);
+      if(!cmSystemTools::RunSingleCommand(orig_cmd, 0, &stdErr, &ret,
+                                          0, cmSystemTools::OUTPUT_PASSTHROUGH))
+        {
+        std::cerr << "Error running: " << orig_cmd[0] << "\n";
+        std::cerr << stdErr << "\n";
+        return 1;
+        }
       // return the value of the real compile command
       return ret;
       }

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

Summary of changes:
 Modules/CMakeCXXInformation.cmake |    2 +-
 Source/CTest/cmCTestLaunch.cxx    |    3 ---
 Source/cmcmd.cxx                  |   33 +++++++++++++++++++++++++++------
 3 files changed, 28 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list