diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-01-14 18:01:38 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-01-14 18:01:38 (GMT) |
commit | 82c3afcf6f78833e55bc6140799b5809a4527f03 (patch) | |
tree | b256f9c50d664798ebbb8f8ab8c94d90acf11cec /Source/CTest/cmCTestBuildCommand.cxx | |
parent | e92d99d05c4edf1a7aae5eee4c66432f9e01d04f (diff) | |
download | CMake-82c3afcf6f78833e55bc6140799b5809a4527f03.zip CMake-82c3afcf6f78833e55bc6140799b5809a4527f03.tar.gz CMake-82c3afcf6f78833e55bc6140799b5809a4527f03.tar.bz2 |
ENH: allow ctest_build to return error and warning counts
Diffstat (limited to 'Source/CTest/cmCTestBuildCommand.cxx')
-rw-r--r-- | Source/CTest/cmCTestBuildCommand.cxx | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 58c3efd..a98f621 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -18,6 +18,7 @@ #include "cmCTest.h" #include "cmCTestGenericHandler.h" +#include "cmCTestBuildHandler.h" #include "cmake.h" #include "cmGlobalGenerator.h" @@ -26,6 +27,10 @@ cmCTestBuildCommand::cmCTestBuildCommand() { this->GlobalGenerator = 0; + this->Arguments[ctb_NUMBER_ERRORS] = "NUMBER_ERRORS"; + this->Arguments[ctb_NUMBER_WARNINGS] = "NUMBER_WARNINGS"; + this->Arguments[ctb_LAST] = 0; + this->Last = ctb_LAST; } //---------------------------------------------------------------------------- @@ -48,7 +53,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() this->SetError("internal CTest error. Cannot instantiate build handler"); return 0; } - + this->Handler = (cmCTestBuildHandler*)handler; const char* ctestBuildCommand = this->Makefile->GetDefinition("CTEST_BUILD_COMMAND"); if ( ctestBuildCommand && *ctestBuildCommand ) @@ -132,3 +137,24 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() } +bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status) +{ + bool ret = cmCTestHandlerCommand::InitialPass(args, status); + if ( this->Values[ctb_NUMBER_ERRORS] && *this->Values[ctb_NUMBER_ERRORS]) + { + cmOStringStream str; + str << this->Handler->GetTotalErrors(); + this->Makefile->AddDefinition( + this->Values[ctb_NUMBER_ERRORS], str.str().c_str()); + } + if ( this->Values[ctb_NUMBER_WARNINGS] + && *this->Values[ctb_NUMBER_WARNINGS]) + { + cmOStringStream str; + str << this->Handler->GetTotalWarnings(); + this->Makefile->AddDefinition( + this->Values[ctb_NUMBER_WARNINGS], str.str().c_str()); + } + return ret; +} |