summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestConfigureCommand.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-05-05 14:18:41 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-05-05 14:18:41 (GMT)
commitb74da8d3aaf931b335b6ddf4eb11b892f8e719c5 (patch)
treeda81388d179b2976083d51d734a3f47d2112f587 /Source/CTest/cmCTestConfigureCommand.cxx
parent407eac60f53141c9a20454922aef917114a88572 (diff)
downloadCMake-b74da8d3aaf931b335b6ddf4eb11b892f8e719c5.zip
CMake-b74da8d3aaf931b335b6ddf4eb11b892f8e719c5.tar.gz
CMake-b74da8d3aaf931b335b6ddf4eb11b892f8e719c5.tar.bz2
ENH: Add default configure rules for CMake projects and add default rules for submission
Diffstat (limited to 'Source/CTest/cmCTestConfigureCommand.cxx')
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx65
1 files changed, 62 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index 2925cad..f7744d7 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -22,11 +22,13 @@
bool cmCTestConfigureCommand::InitialPass(
std::vector<std::string> const& args)
{
+ 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 )
@@ -34,9 +36,14 @@ bool cmCTestConfigureCommand::InitialPass(
res_var = args[i].c_str();
havereturn_variable = false;
}
- else if ( havesource )
+ 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")
@@ -48,6 +55,15 @@ bool cmCTestConfigureCommand::InitialPass(
}
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 )
@@ -55,7 +71,7 @@ bool cmCTestConfigureCommand::InitialPass(
this->SetError("called with incorrect number of arguments. BUILD specified twice.");
return false;
}
- havesource = true;
+ havebuild = true;
}
else
{
@@ -66,12 +82,55 @@ bool cmCTestConfigureCommand::InitialPass(
}
}
- m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "ConfigureCommand", "CTEST_CONFIGURE_COMMAND");
+ if ( source_dir )
+ {
+ m_CTest->SetCTestConfiguration("SourceDirectory", source_dir);
+ }
+ else
+ {
+ source_dir = m_Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY");
+ }
if ( build_dir )
{
m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
}
+ else
+ {
+ build_dir = m_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;
+ }
+ }
+
+
+ const char* ctestConfigureCommand = m_Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
+ if ( ctestConfigureCommand && *ctestConfigureCommand )
+ {
+ m_CTest->SetCTestConfiguration("ConfigureCommand", ctestConfigureCommand);
+ }
+ else
+ {
+ const char* cmakeGeneratorName = m_Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
+ if ( cmakeGeneratorName && *cmakeGeneratorName )
+ {
+ std::string cmakeConfigureCommand = "\"";
+ cmakeConfigureCommand += m_CTest->GetCMakeExecutable();
+ cmakeConfigureCommand += "\" \"-G";
+ cmakeConfigureCommand += cmakeGeneratorName;
+ cmakeConfigureCommand += "\" \"";
+ cmakeConfigureCommand += source_dir;
+ cmakeConfigureCommand += "\"";
+ m_CTest->SetCTestConfiguration("ConfigureCommand", cmakeConfigureCommand.c_str());
+ }
+ else
+ {
+ this->SetError("Configure command is not specified. If this is a CMake project, specify CTEST_CMAKE_GENERATOR, or if this is not CMake project, specify CTEST_CONFIGURE_COMMAND.");
+ return false;
+ }
+ }
cmCTestGenericHandler* handler = m_CTest->GetHandler("configure");
if ( !handler )