summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-25 12:06:59 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-27 06:44:25 (GMT)
commit8caf1f361b2207522d19bf4a28cecaa3a2391918 (patch)
treeaf905ed60f26c9ea9afdab16403558bc8f14c949 /Source
parent278ba2db477fdc8cccd2313eb56e0179234747a0 (diff)
downloadCMake-8caf1f361b2207522d19bf4a28cecaa3a2391918.zip
CMake-8caf1f361b2207522d19bf4a28cecaa3a2391918.tar.gz
CMake-8caf1f361b2207522d19bf4a28cecaa3a2391918.tar.bz2
cmGlobalGenerator: Add FindGeneratorTarget API
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx48
-rw-r--r--Source/cmGlobalGenerator.h6
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();