summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestSubmitCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest/cmCTestSubmitCommand.cxx')
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx39
1 files changed, 31 insertions, 8 deletions
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 72fccb8..4e0d74a 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -22,14 +22,34 @@
bool cmCTestSubmitCommand::InitialPass(
std::vector<std::string> const& args)
{
- if (args.size() != 1)
+ const char* res_var = 0;
+
+ bool havereturn_variable = false;
+ for(size_t i=0; i < args.size(); ++i)
{
- this->SetError("called with incorrect number of arguments");
- return false;
+ if ( havereturn_variable )
+ {
+ res_var = args[i].c_str();
+ havereturn_variable = false;
+ }
+ else if(args[i] == "RETURN_VALUE")
+ {
+ if ( res_var )
+ {
+ this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
+ return false;
+ }
+ havereturn_variable = true;
+ }
+ else
+ {
+ cmOStringStream str;
+ str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
+ this->SetError(str.str().c_str());
+ return false;
+ }
}
- const char* res_var = args[0].c_str();
-
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropMethod", "CTEST_DROP_METHOD");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropSite", "CTEST_DROP_SITE");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropLocation", "CTEST_DROP_LOCATION");
@@ -45,9 +65,12 @@ bool cmCTestSubmitCommand::InitialPass(
return false;
}
int res = handler->ProcessHandler();
- cmOStringStream str;
- str << res;
- m_Makefile->AddDefinition(res_var, str.str().c_str());
+ if ( res_var )
+ {
+ cmOStringStream str;
+ str << res;
+ m_Makefile->AddDefinition(res_var, str.str().c_str());
+ }
return true;
}