summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-25 11:52:46 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-27 06:44:24 (GMT)
commitdef6da616b81958c9f1058a4e520ac3cbc534757 (patch)
treed2586262b7f973e0d3c095c810ec829e815a9f4d
parenta67231ac114235f0af4673235c4c07fa896c8ab6 (diff)
downloadCMake-def6da616b81958c9f1058a4e520ac3cbc534757.zip
CMake-def6da616b81958c9f1058a4e520ac3cbc534757.tar.gz
CMake-def6da616b81958c9f1058a4e520ac3cbc534757.tar.bz2
cmLocalGenerator: Port FindGeneratorTarget away from GetGeneratorTarget
-rw-r--r--Source/cmLocalGenerator.cxx40
-rw-r--r--Source/cmLocalGenerator.h1
-rw-r--r--Source/cmMakefile.h5
3 files changed, 44 insertions, 2 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b5f5ce9..9d5335e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -51,6 +51,8 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
this->Makefile = makefile;
+ this->AliasTargets = makefile->GetAliasTargets();
+
this->EmitUniversalBinaryFlags = true;
this->BackwardsCompatibility = 0;
this->BackwardsCompatibilityFinal = false;
@@ -453,11 +455,45 @@ void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt)
this->GeneratorTargets.push_back(gt);
}
+struct NamedGeneratorTargetFinder
+{
+ NamedGeneratorTargetFinder(std::string const& name)
+ : Name(name)
+ {
+
+ }
+
+ bool operator()(cmGeneratorTarget* tgt)
+ {
+ return tgt->GetName() == this->Name;
+ }
+private:
+ std::string Name;
+};
+
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTarget(
const std::string& name) const
{
- return this->GetGlobalGenerator()->GetGeneratorTarget(
- this->Makefile->FindTarget(name));
+ std::map<std::string, std::string>::const_iterator i =
+ this->AliasTargets.find(name);
+ if (i != this->AliasTargets.end())
+ {
+ std::vector<cmGeneratorTarget*>::const_iterator ai =
+ std::find_if(this->GeneratorTargets.begin(),
+ this->GeneratorTargets.end(),
+ NamedGeneratorTargetFinder(i->second));
+ return *ai;
+ }
+ std::vector<cmGeneratorTarget*>::const_iterator ti =
+ std::find_if(this->GeneratorTargets.begin(),
+ this->GeneratorTargets.end(),
+ NamedGeneratorTargetFinder(name));
+ if ( ti != this->GeneratorTargets.end() )
+ {
+ return *ti;
+ }
+
+ return 0;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 46eb1b3..91a476f 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -373,6 +373,7 @@ protected:
std::set<cmGeneratorTarget const*> WarnCMP0063;
std::vector<cmGeneratorTarget*> GeneratorTargets;
+ std::map<std::string, std::string> AliasTargets;
bool EmitUniversalBinaryFlags;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 35dd3c6..01c4524 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -400,6 +400,11 @@ public:
bool excludeAliases = false) const;
bool IsAlias(const std::string& name) const;
+ std::map<std::string, std::string> GetAliasTargets() const
+ {
+ return this->AliasTargets;
+ }
+
/**
* Mark include directories as system directories.
*/