summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx65
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx31
2 files changed, 89 insertions, 7 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 )
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 4e0d74a..b8fe466 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -50,12 +50,35 @@ bool cmCTestSubmitCommand::InitialPass(
}
}
- 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");
+ const char* ctestDropMethod = m_Makefile->GetDefinition("CTEST_DROP_METHOD");
+ const char* ctestDropSite = m_Makefile->GetDefinition("CTEST_DROP_SITE");
+ const char* ctestDropLocation = m_Makefile->GetDefinition("CTEST_DROP_LOCATION");
+ const char* ctestTriggerSite = m_Makefile->GetDefinition("CTEST_TRIGGER_SITE");
+
+ if ( !ctestDropMethod )
+ {
+ ctestDropMethod = "http";
+ }
+ if ( !ctestDropSite )
+ {
+ ctestDropSite = "public.kitware.com";
+ }
+ if ( !ctestDropLocation )
+ {
+ ctestDropLocation = "/cgi-bin/HTTPUploadDartFile.cgi";
+ }
+ if ( !ctestTriggerSite )
+ {
+ ctestTriggerSite = "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi";
+ }
+
+ m_CTest->SetCTestConfiguration("DropMethod", ctestDropMethod);
+ m_CTest->SetCTestConfiguration("DropSite", ctestDropSite);
+ m_CTest->SetCTestConfiguration("DropLocation", ctestDropLocation);
+ m_CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite);
+
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropSiteUser", "CTEST_DROP_SITE_USER");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropSitePassword", "CTEST_DROP_SITE_PASSWORD");
- m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "TriggerSite", "CTEST_TRIGGER_SITE");
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "ScpCommand", "CTEST_SCP_COMMAND");
cmCTestGenericHandler* handler = m_CTest->GetHandler("submit");