diff options
author | Ken Martin <ken.martin@kitware.com> | 2006-12-07 19:54:15 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2006-12-07 19:54:15 (GMT) |
commit | a00200e8d409e334d8646d4817d8e78fc11fc311 (patch) | |
tree | 779eb9de89cedb5b0d45073c835db3d6e2e964ef /Source/cmSetTestsPropertiesCommand.cxx | |
parent | 013ec3988129761543b8491e5177f3105a09299a (diff) | |
download | CMake-a00200e8d409e334d8646d4817d8e78fc11fc311.zip CMake-a00200e8d409e334d8646d4817d8e78fc11fc311.tar.gz CMake-a00200e8d409e334d8646d4817d8e78fc11fc311.tar.bz2 |
ENH: implements SetProperties for TEST
Diffstat (limited to 'Source/cmSetTestsPropertiesCommand.cxx')
-rw-r--r-- | Source/cmSetTestsPropertiesCommand.cxx | 69 |
1 files changed, 46 insertions, 23 deletions
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index f1f571a..8e02ada 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -74,38 +74,61 @@ bool cmSetTestsPropertiesCommand::InitialPass( return false; } + std::vector<cmTest*> &tests = *this->Makefile->GetTests(); // now loop over all the targets int i; - unsigned int k; for(i = 0; i < numFiles; ++i) { - bool found = false; - // if the file is already in the makefile just set properites on it - std::vector<cmTest*>::iterator it; - for ( it = tests.begin(); it != tests.end(); ++ it ) + std::string errors; + bool ret = + cmSetTestsPropertiesCommand::SetOneTest(args[i].c_str(), + propertyPairs, + this->Makefile, errors); + if (!ret) { - cmTest* test = *it; - if ( test->GetName() == args[i] ) - { - // now loop through all the props and set them - for (k = 0; k < propertyPairs.size(); k = k + 2) - { - test->SetProperty(propertyPairs[k].c_str(), - propertyPairs[k+1].c_str()); - } - found = true; - break; - } + this->SetError(errors.c_str()); + return ret; } + } + + return true; +} + - // if file is not already in the makefile, then add it - if ( ! found ) - { - std::string message = "Can not find test to add properties to: "; - message += args[i]; - this->SetError(message.c_str()); +bool cmSetTestsPropertiesCommand +::SetOneTest(const char *tname, + std::vector<std::string> &propertyPairs, + cmMakefile *mf, std::string &errors) +{ + std::vector<cmTest*> &tests = *mf->GetTests(); + // now loop over all the targets + unsigned int k; + bool found = false; + // if the file is already in the makefile just set properites on it + std::vector<cmTest*>::iterator it; + for ( it = tests.begin(); it != tests.end(); ++ it ) + { + cmTest* test = *it; + if ( test->GetName() == tname ) + { + // now loop through all the props and set them + for (k = 0; k < propertyPairs.size(); k = k + 2) + { + test->SetProperty(propertyPairs[k].c_str(), + propertyPairs[k+1].c_str()); + } + found = true; + break; } + } + + // if file is not already in the makefile, then add it + if ( ! found ) + { + errors = "Can not find test to add properties to: "; + errors += tname; + return false; } return true; |