summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestBuildCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest/cmCTestBuildCommand.cxx')
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx61
1 files changed, 51 insertions, 10 deletions
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 0f9b309..d8f1ef7 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -24,16 +24,55 @@
bool cmCTestBuildCommand::InitialPass(
std::vector<std::string> const& args)
{
- if (args.size() != 2)
+ const char* build_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 )
+ {
+ build_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] == "BUILD")
+ {
+ if ( build_dir )
+ {
+ this->SetError("called with incorrect number of arguments. BUILD 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* build_dir = args[0].c_str();
- const char* res_var = args[1].c_str();
+ if ( build_dir )
+ {
+ m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
+ }
- m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
cmCTestGenericHandler* handler = m_CTest->GetHandler("build");
if ( !handler )
{
@@ -62,7 +101,6 @@ bool cmCTestBuildCommand::InitialPass(
m_Makefile->GetCMakeInstance()->CreateGlobalGenerator(cmakeGeneratorName);
gen->FindMakeProgram(m_Makefile);
const char* cmakeMakeProgram = m_Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
- std::cout << "CMake Make program is: " << cmakeMakeProgram << std::endl;
std::string buildCommand = gen->GenerateBuildCommand(cmakeMakeProgram, cmakeProjectName,
0, cmakeBuildConfiguration, true);
@@ -78,9 +116,12 @@ bool cmCTestBuildCommand::InitialPass(
}
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;
}