summaryrefslogtreecommitdiffstats
path: root/Source/cmAddTestCommand.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2011-01-20 19:05:39 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2011-01-20 19:05:39 (GMT)
commitd94f9c6487b324e7453deff15c8968acba23d98f (patch)
tree4c9e0748f798077cc8becd3789a06ec98670a712 /Source/cmAddTestCommand.cxx
parentb6c302b1aac9d903e5904febcec0902605dacee2 (diff)
downloadCMake-d94f9c6487b324e7453deff15c8968acba23d98f.zip
CMake-d94f9c6487b324e7453deff15c8968acba23d98f.tar.gz
CMake-d94f9c6487b324e7453deff15c8968acba23d98f.tar.bz2
Only set the property if the property was given
Diffstat (limited to 'Source/cmAddTestCommand.cxx')
-rw-r--r--Source/cmAddTestCommand.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 72a6e93..a9165f5 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -74,8 +74,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
{
std::string name;
std::vector<std::string> configurations;
- std::string working_directory = this->Makefile->GetCurrentOutputDirectory();
- bool working_directory_set = false;
+ std::string working_directory;
std::vector<std::string> command;
// Read the arguments.
@@ -109,13 +108,12 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
}
else if(args[i] == "WORKING_DIRECTORY")
{
- if(working_directory_set)
+ if(!working_directory.empty())
{
this->SetError(" may be given at most one WORKING_DIRECTORY.");
return false;
}
doing = DoingWorkingDirectory;
- working_directory_set = true;
}
else if(doing == DoingName)
{
@@ -172,7 +170,10 @@ 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());
+ if(!working_directory.empty())
+ {
+ test->SetProperty("WORKING_DIRECTORY", working_directory.c_str());
+ }
this->Makefile->AddTestGenerator(new cmTestGenerator(test, configurations));
return true;