summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestConfigureCommand.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2006-03-29 17:01:24 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2006-03-29 17:01:24 (GMT)
commit386900bfdd5836ccabeb0c050a6292c50aec79d6 (patch)
tree8316484c17eb5201a18f11ee8ff6245ae29ce365 /Source/CTest/cmCTestConfigureCommand.cxx
parentb75166ea45173f8bc2cb9076f511a51b8112f61b (diff)
downloadCMake-386900bfdd5836ccabeb0c050a6292c50aec79d6.zip
CMake-386900bfdd5836ccabeb0c050a6292c50aec79d6.tar.gz
CMake-386900bfdd5836ccabeb0c050a6292c50aec79d6.tar.bz2
ENH: Several cleanups and make sure things get propagated where they should. Also, allow to load CTest custom files to the actual ctest -S script
Diffstat (limited to 'Source/CTest/cmCTestConfigureCommand.cxx')
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx117
1 files changed, 28 insertions, 89 deletions
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index 2d5a16f..829f4a5 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -19,98 +19,35 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
-bool cmCTestConfigureCommand::InitialPass(
- std::vector<std::string> const& args)
+cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
{
- const char* source_dir = 0;
- const char* build_dir = 0;
- const char* res_var = 0;
-
- bool havereturn_variable = false;
- bool havesource = false;
- bool havebuild = false;
- for(size_t i=0; i < args.size(); ++i)
- {
- if ( havereturn_variable )
- {
- res_var = args[i].c_str();
- havereturn_variable = false;
- }
- else if ( havebuild )
- {
- build_dir = args[i].c_str();
- havebuild = 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 if(args[i] == "BUILD")
- {
- if ( build_dir )
- {
- this->SetError("called with incorrect number of arguments. "
- "BUILD specified twice.");
- return false;
- }
- havebuild = 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;
- }
- }
-
- if ( source_dir )
+ if ( this->Values[ct_BUILD] )
{
- this->CTest->SetCTestConfiguration("SourceDirectory", source_dir);
+ this->CTest->SetCTestConfiguration("BuildDirectory",
+ this->Values[ct_BUILD]);
}
else
{
- source_dir = this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY");
+ this->CTest->SetCTestConfiguration("BuildDirectory",
+ this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY"));
}
-
- if ( build_dir )
+ if ( this->Values[ct_SOURCE] )
{
- this->CTest->SetCTestConfiguration("BuildDirectory", build_dir);
+ this->CTest->SetCTestConfiguration("SourceDirectory",
+ this->Values[ct_SOURCE]);
}
else
{
- build_dir = this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY");
- if ( !build_dir )
- {
- this->SetError("Build directory not specified. Either use BUILD "
- "argument to CTEST_CONFIGURE command or set CTEST_BINARY_DIRECTORY "
- "variable");
- return false;
- }
+ this->CTest->SetCTestConfiguration("SourceDirectory",
+ this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"));
+ }
+ if ( this->CTest->GetCTestConfiguration("BuildDirectory").empty() )
+ {
+ this->SetError("Build directory not specified. Either use BUILD "
+ "argument to CTEST_CONFIGURE command or set CTEST_BINARY_DIRECTORY "
+ "variable");
+ return false;
}
-
const char* ctestConfigureCommand
= this->Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
@@ -125,6 +62,15 @@ bool cmCTestConfigureCommand::InitialPass(
= this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
if ( cmakeGeneratorName && *cmakeGeneratorName )
{
+ const std::string& source_dir
+ = this->CTest->GetCTestConfiguration("SourceDirectory");
+ if ( source_dir.empty() )
+ {
+ this->SetError("Source directory not specified. Either use SOURCE "
+ "argument to CTEST_CONFIGURE command or set CTEST_SOURCE_DIRECTORY "
+ "variable");
+ return false;
+ }
std::string cmakeConfigureCommand = "\"";
cmakeConfigureCommand += this->CTest->GetCMakeExecutable();
cmakeConfigureCommand += "\" \"-G";
@@ -152,14 +98,7 @@ bool cmCTestConfigureCommand::InitialPass(
"internal CTest error. Cannot instantiate configure handler");
return false;
}
- int res = handler->ProcessHandler();
- if ( res_var )
- {
- cmOStringStream str;
- str << res;
- this->Makefile->AddDefinition(res_var, str.str().c_str());
- }
- return true;
+ return handler;
}