diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-25 12:06:59 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-27 06:44:25 (GMT) |
commit | 8caf1f361b2207522d19bf4a28cecaa3a2391918 (patch) | |
tree | af905ed60f26c9ea9afdab16403558bc8f14c949 /Source/cmGlobalGenerator.cxx | |
parent | 278ba2db477fdc8cccd2313eb56e0179234747a0 (diff) | |
download | CMake-8caf1f361b2207522d19bf4a28cecaa3a2391918.zip CMake-8caf1f361b2207522d19bf4a28cecaa3a2391918.tar.gz CMake-8caf1f361b2207522d19bf4a28cecaa3a2391918.tar.bz2 |
cmGlobalGenerator: Add FindGeneratorTarget API
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6b5cb97..5928fb5 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2196,6 +2196,25 @@ cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const return 0; } +cmGeneratorTarget* +cmGlobalGenerator::FindGeneratorTargetImpl(std::string const& name) const +{ + for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) + { + std::vector<cmGeneratorTarget*> tgts = + this->LocalGenerators[i]->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::iterator it = tgts.begin(); + it != tgts.end(); ++it) + { + if ((*it)->GetName() == name) + { + return *it; + } + } + } + return 0; +} + cmTarget* cmGlobalGenerator::FindImportedTargetImpl(std::string const& name) const { @@ -2215,6 +2234,25 @@ cmGlobalGenerator::FindImportedTargetImpl(std::string const& name) const return 0; } +cmGeneratorTarget* cmGlobalGenerator::FindImportedGeneratorTargetImpl( + std::string const& name) const +{ + for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) + { + std::vector<cmGeneratorTarget*> tgts = + this->LocalGenerators[i]->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::iterator it = tgts.begin(); + it != tgts.end(); ++it) + { + if ((*it)->GetName() == name && (*it)->IsImportedGloballyVisible()) + { + return *it; + } + } + } + return 0; +} + //---------------------------------------------------------------------------- cmTarget* cmGlobalGenerator::FindTarget(const std::string& name, @@ -2236,6 +2274,16 @@ cmGlobalGenerator::FindTarget(const std::string& name, return this->FindImportedTargetImpl(name); } +cmGeneratorTarget* +cmGlobalGenerator::FindGeneratorTarget(const std::string& name) const +{ + if (cmGeneratorTarget* tgt = this->FindGeneratorTargetImpl(name)) + { + return tgt; + } + return this->FindImportedGeneratorTargetImpl(name); +} + //---------------------------------------------------------------------------- bool cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const |