summaryrefslogtreecommitdiffstats
path: root/Source/cmAddTestCommand.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2010-12-16 21:48:27 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2010-12-16 21:50:47 (GMT)
commit42de5d02dddec69ee045b423fbd58751f210839d (patch)
treeef4e5be3b9b77c42eb146efe79922fe6584150b4 /Source/cmAddTestCommand.cxx
parent7679f9fab099e729b61320927a9e0b8d03546f7f (diff)
downloadCMake-42de5d02dddec69ee045b423fbd58751f210839d.zip
CMake-42de5d02dddec69ee045b423fbd58751f210839d.tar.gz
CMake-42de5d02dddec69ee045b423fbd58751f210839d.tar.bz2
Add WORKING_DIRECTORY argument to add_test
Diffstat (limited to 'Source/cmAddTestCommand.cxx')
-rw-r--r--Source/cmAddTestCommand.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 923206d..11ca9e7 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -74,6 +74,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
{
std::string name;
std::vector<std::string> configurations;
+ std::string working_directory;
std::vector<std::string> command;
// Read the arguments.
@@ -81,6 +82,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
DoingName,
DoingCommand,
DoingConfigs,
+ DoingWorkingDirectory,
DoingNone
};
Doing doing = DoingName;
@@ -104,6 +106,15 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
}
doing = DoingConfigs;
}
+ else if(args[i] == "WORKING_DIRECTORY")
+ {
+ if(!working_directory.empty())
+ {
+ this->SetError(" may be given at most one WORKING_DIRECTORY.");
+ return false;
+ }
+ doing = DoingWorkingDirectory;
+ }
else if(doing == DoingName)
{
name = args[i];
@@ -117,6 +128,11 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
{
configurations.push_back(args[i]);
}
+ else if(doing == DoingWorkingDirectory)
+ {
+ working_directory = args[i];
+ doing = DoingNone;
+ }
else
{
cmOStringStream e;
@@ -154,6 +170,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
cmTest* test = this->Makefile->CreateTest(name.c_str());
test->SetOldStyle(false);
test->SetCommand(command);
+ test->SetProperty("WORKING_DIRECTORY", working_directory.c_str());
this->Makefile->AddTestGenerator(new cmTestGenerator(test, configurations));
return true;