diff options
author | Ken Martin <ken.martin@kitware.com> | 2006-12-07 14:45:32 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2006-12-07 14:45:32 (GMT) |
commit | 27379d7b081be852c2b290a98db548cffffbff04 (patch) | |
tree | fcc9e19282bdfb71bf4bf9b1f8fcea1401c2fbd5 /Source/cmSetTargetPropertiesCommand.cxx | |
parent | 833548f53a2ed799bb0df23fd7d973c30b423d1b (diff) | |
download | CMake-27379d7b081be852c2b290a98db548cffffbff04.zip CMake-27379d7b081be852c2b290a98db548cffffbff04.tar.gz CMake-27379d7b081be852c2b290a98db548cffffbff04.tar.bz2 |
ENH: make properties a bit more formal with documentation and chaining
Diffstat (limited to 'Source/cmSetTargetPropertiesCommand.cxx')
-rw-r--r-- | Source/cmSetTargetPropertiesCommand.cxx | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index cb7d60e..f7910a0 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -71,27 +71,14 @@ bool cmSetTargetPropertiesCommand::InitialPass( return false; } - cmTargets& targets = this->Makefile->GetTargets(); // now loop over all the targets int i; - unsigned int k; for(i = 0; i < numFiles; ++i) { - // if the file is already in the makefile just set properites on it - cmTargets::iterator t = targets.find(args[i]); - if ( t != targets.end()) + bool ret = cmSetTargetPropertiesCommand::SetOneTarget + (args[i].c_str(),propertyPairs,this->Makefile); + if (!ret) { - cmTarget& target = t->second; - // now loop through all the props and set them - for (k = 0; k < propertyPairs.size(); k = k + 2) - { - target.SetProperty(propertyPairs[k].c_str(), - propertyPairs[k+1].c_str()); - } - } - // if file is not already in the makefile, then add it - else - { std::string message = "Can not find target to add properties to: "; message += args[i]; this->SetError(message.c_str()); @@ -101,3 +88,30 @@ bool cmSetTargetPropertiesCommand::InitialPass( return true; } +bool cmSetTargetPropertiesCommand +::SetOneTarget(const char *tname, + std::vector<std::string> &propertyPairs, + cmMakefile *mf) +{ + cmTargets& targets = mf->GetTargets(); + + // if the file is already in the makefile just set properites on it + cmTargets::iterator t = targets.find(tname); + if ( t != targets.end()) + { + cmTarget& target = t->second; + // now loop through all the props and set them + unsigned int k; + for (k = 0; k < propertyPairs.size(); k = k + 2) + { + target.SetProperty(propertyPairs[k].c_str(), + propertyPairs[k+1].c_str()); + } + } + // if file is not already in the makefile, then add it + else + { + return false; + } + return true; +} |