diff options
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 48 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 6 |
2 files changed, 54 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 diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 419cada..c52b209 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -254,6 +254,8 @@ public: cmTarget* FindTarget(const std::string& name, bool excludeAliases = false) const; + cmGeneratorTarget* FindGeneratorTarget(const std::string& name) const; + void AddAlias(const std::string& name, const std::string& tgtName); bool IsAlias(const std::string& name) const; @@ -432,6 +434,10 @@ protected: cmTarget* FindTargetImpl(std::string const& name) const; cmTarget* FindImportedTargetImpl(std::string const& name) const; + cmGeneratorTarget* FindGeneratorTargetImpl(std::string const& name) const; + cmGeneratorTarget* + FindImportedGeneratorTargetImpl(std::string const& name) const; + const char* GetPredefinedTargetsFolder(); virtual bool UseFolderProperty(); |