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 13e86829073482237617637c644b073a6f3300c5 (commit) via 69a600d4d9adc582523ac8888f5c83abbb989461 (commit) from 4283712685e5e31ff05db587ea7cfcfdc203f447 (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=13e86829073482237617637c644b073a6f3300c5 commit 13e86829073482237617637c644b073a6f3300c5 Merge: 4283712 69a600d Author: Bill Hoffman <bill.hoff...@kitware.com> AuthorDate: Tue May 12 17:05:03 2015 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Tue May 12 17:05:03 2015 -0400 Merge topic 'add-iwyu-support' into next 69a600d4 add support for include what you use (iwyu) to CMake/CTest. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69a600d4d9adc582523ac8888f5c83abbb989461 commit 69a600d4d9adc582523ac8888f5c83abbb989461 Author: Bill Hoffman <bill.hoff...@kitware.com> AuthorDate: Tue May 12 16:37:11 2015 -0400 Commit: Bill Hoffman <bill.hoff...@kitware.com> CommitDate: Tue May 12 16:37:11 2015 -0400 add support for include what you use (iwyu) to CMake/CTest. This commit adds a cmake -E command to run iwyu in place of a compiler for the compile line, then it then runs the compiler. This is inserted into the COMPILE_CXX_OBJECT command if CMAKE_IWYU_EXECUTABLE is set in the project. This allows for a complete build to be done since iwyu can not actually build files. The output from iwyu is treated as a warning by ctest and will show up nicely on CDash when ctest launchers are used. diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 72b2857..c186eeb 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -280,6 +280,14 @@ if(NOT CMAKE_CXX_COMPILE_OBJECT) set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>") endif() +# check to see if CMAKE_IWYU_EXECUTABLE is set. If yes, +# then use the cmake -E __run_iwyu command to run iwyu +# 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}") +endif() + if(NOT CMAKE_CXX_LINK_EXECUTABLE) set(CMAKE_CXX_LINK_EXECUTABLE diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 29e07ef..98dfcfa 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -133,6 +133,8 @@ static const char* cmCTestWarningMatches[] = { "cc-[0-9]* CC: REMARK File = .*, Line = [0-9]*", "^CMake Warning.*:", "^\\[WARNING\\]", + ".*should remove these lines:", + ".*should add these lines:", 0 }; diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index de6ecde..bf271e9 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -649,7 +649,9 @@ 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 12bb8ee..79177fb 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -210,6 +210,57 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) } return 0; } + // run include what you use command and then run the compile + // command. This is an internal undocumented option and should + // only be used by CMake itself when running iwyu. + else if (args[1] == "__run_iwyu") + { + if(args.size() < 3) + { + std::cerr << "__run_iwyu Usage: -E __run_iwyu [--iwyu=/path/iwyu]" + " -- compile command\n"; + return 1; + } + bool doing_options = true; + std::vector<std::string> orig_cmd; + std::string cmd; + for (std::string::size_type cc = 2; cc < args.size(); cc ++) + { + std::string const& arg = args[cc]; + if(arg == "--") + { + doing_options = false; + } + else if (doing_options && cmHasLiteralPrefix(arg, "--iwyu=")) + { + cmd = arg.substr(7); + } + else if(!doing_options) + { + orig_cmd.push_back(arg); + } + } + if(cmd.size() == 0) + { + std::cerr << "__run_iwyu missing iwyu path --iwyu=/path/to/iwyu\n"; + return 1; + } + if(orig_cmd.size() == 0) + { + std::cerr << "__run_iwyu missing compile command after --\n"; + return 1; + } + std::vector<std::string> iwyucmd = orig_cmd; + iwyucmd[0] = cmd; + int ret = 0; + cmSystemTools::RunSingleCommand(iwyucmd, 0, 0, 0, + 0, cmSystemTools::OUTPUT_PASSTHROUGH); + // the return value of iwyu is ignored as it is always fail + cmSystemTools::RunSingleCommand(orig_cmd, 0, 0, &ret, + 0, cmSystemTools::OUTPUT_PASSTHROUGH); + // return the value of the real compile command + return ret; + } // Echo string else if (args[1] == "echo" ) @@ -696,7 +747,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return autogenSuccess ? 0 : 1; } #endif - // Tar files else if (args[1] == "tar" && args.size() > 3) { ----------------------------------------------------------------------- Summary of changes: Modules/CMakeCXXInformation.cmake | 8 ++++++ Source/CTest/cmCTestBuildHandler.cxx | 2 ++ Source/CTest/cmCTestLaunch.cxx | 4 ++- Source/cmcmd.cxx | 52 +++++++++++++++++++++++++++++++++- 4 files changed, 64 insertions(+), 2 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits