diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-05-04 15:13:35 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-05-04 15:13:35 (GMT) |
commit | 9619d54003970f9160b31ad6e04c85b1812faf3f (patch) | |
tree | e64ba872c0c683417d41dd884decce63c4488c9e /Source/CTest/cmCTestSubmitCommand.cxx | |
parent | 082b3b44d73b19aa1461eaa91e228317d9373d67 (diff) | |
download | CMake-9619d54003970f9160b31ad6e04c85b1812faf3f.zip CMake-9619d54003970f9160b31ad6e04c85b1812faf3f.tar.gz CMake-9619d54003970f9160b31ad6e04c85b1812faf3f.tar.bz2 |
ENH: Improve syntax
Diffstat (limited to 'Source/CTest/cmCTestSubmitCommand.cxx')
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.cxx | 39 |
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; } |