summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestUpdateCommand.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-05-04 15:13:35 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-05-04 15:13:35 (GMT)
commit9619d54003970f9160b31ad6e04c85b1812faf3f (patch)
treee64ba872c0c683417d41dd884decce63c4488c9e /Source/CTest/cmCTestUpdateCommand.cxx
parent082b3b44d73b19aa1461eaa91e228317d9373d67 (diff)
downloadCMake-9619d54003970f9160b31ad6e04c85b1812faf3f.zip
CMake-9619d54003970f9160b31ad6e04c85b1812faf3f.tar.gz
CMake-9619d54003970f9160b31ad6e04c85b1812faf3f.tar.bz2
ENH: Improve syntax
Diffstat (limited to 'Source/CTest/cmCTestUpdateCommand.cxx')
-rw-r--r--Source/CTest/cmCTestUpdateCommand.cxx61
1 files changed, 51 insertions, 10 deletions
diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx
index d8ba866..c0e00ae 100644
--- a/Source/CTest/cmCTestUpdateCommand.cxx
+++ b/Source/CTest/cmCTestUpdateCommand.cxx
@@ -22,15 +22,50 @@
bool cmCTestUpdateCommand::InitialPass(
std::vector<std::string> const& args)
{
- if (args.size() != 2)
+ const char* source_dir = 0;
+ const char* res_var = 0;
+
+ bool havereturn_variable = false;
+ bool havesource = 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 ( havesource )
+ {
+ source_dir = args[i].c_str();
+ havesource = 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 if(args[i] == "SOURCE")
+ {
+ if ( source_dir )
+ {
+ this->SetError("called with incorrect number of arguments. SOURCE specified twice.");
+ return false;
+ }
+ havesource = 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* source_dir = args[0].c_str();
- const char* res_var = args[1].c_str();
-
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "CVSCommand", "CTEST_CVS_COMMAND");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "SVNCommand", "CTEST_SVN_COMMAND");
@@ -40,11 +75,17 @@ bool cmCTestUpdateCommand::InitialPass(
this->SetError("internal CTest error. Cannot instantiate update handler");
return false;
}
- handler->SetOption("SourceDirectory", source_dir);
+ if ( source_dir )
+ {
+ handler->SetOption("SourceDirectory", source_dir);
+ }
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;
}