diff options
author | David Cole <david.cole@kitware.com> | 2008-12-30 14:13:02 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2008-12-30 14:13:02 (GMT) |
commit | 9457ca3cf593a82f9ffb90534ffe6285c235b8c1 (patch) | |
tree | 47a3caa433385feceea6379f2c52d11afc679aaf /Source/CTest/cmCTestConfigureCommand.cxx | |
parent | b6402578843ea0b5ae05028b57465aa877e12c28 (diff) | |
download | CMake-9457ca3cf593a82f9ffb90534ffe6285c235b8c1.zip CMake-9457ca3cf593a82f9ffb90534ffe6285c235b8c1.tar.gz CMake-9457ca3cf593a82f9ffb90534ffe6285c235b8c1.tar.bz2 |
ENH: Add OPTIONS argument to the ctest_configure command so that you can pass -D arguments to the cmake configure step from a ctest -S script. Also clarify/correct some not so helpful error messages.
Diffstat (limited to 'Source/CTest/cmCTestConfigureCommand.cxx')
-rw-r--r-- | Source/CTest/cmCTestConfigureCommand.cxx | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index ce2ff3c..1406044 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -19,8 +19,22 @@ #include "cmCTest.h" #include "cmCTestGenericHandler.h" +cmCTestConfigureCommand::cmCTestConfigureCommand() +{ + this->Arguments[ctc_OPTIONS] = "OPTIONS"; + this->Arguments[ctc_LAST] = 0; + this->Last = ctc_LAST; +} + cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() { + std::vector<std::string> options; + + if (this->Values[ctc_OPTIONS]) + { + cmSystemTools::ExpandListArgument(this->Values[ctc_OPTIONS], options); + } + if ( this->Values[ct_BUILD] ) { this->CTest->SetCTestConfiguration("BuildDirectory", @@ -33,6 +47,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmSystemTools::CollapseFullPath( this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY")).c_str()); } + if ( this->Values[ct_SOURCE] ) { this->CTest->SetCTestConfiguration("SourceDirectory", @@ -45,6 +60,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmSystemTools::CollapseFullPath( this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY")).c_str()); } + if ( this->CTest->GetCTestConfiguration("BuildDirectory").empty() ) { this->SetError("Build directory not specified. Either use BUILD " @@ -77,11 +93,26 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() } std::string cmakeConfigureCommand = "\""; cmakeConfigureCommand += this->CTest->GetCMakeExecutable(); - cmakeConfigureCommand += "\" \"-G"; + cmakeConfigureCommand += "\""; + + std::vector<std::string>::const_iterator it; + std::string option; + for (it= options.begin(); it!=options.end(); ++it) + { + option = *it; + cmakeConfigureCommand += " \""; + cmakeConfigureCommand += option; + cmakeConfigureCommand += "\""; + } + + cmakeConfigureCommand += " \"-G"; cmakeConfigureCommand += cmakeGeneratorName; - cmakeConfigureCommand += "\" \""; + cmakeConfigureCommand += "\""; + + cmakeConfigureCommand += " \""; cmakeConfigureCommand += source_dir; cmakeConfigureCommand += "\""; + this->CTest->SetCTestConfiguration("ConfigureCommand", cmakeConfigureCommand.c_str()); } @@ -104,5 +135,3 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() } return handler; } - - |