cmLocalGenerator: Port FindGeneratorTarget away from GetGeneratorTarget
This commit is contained in:
parent
a67231ac11
commit
def6da616b
|
@ -51,6 +51,8 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
|
||||||
|
|
||||||
this->Makefile = makefile;
|
this->Makefile = makefile;
|
||||||
|
|
||||||
|
this->AliasTargets = makefile->GetAliasTargets();
|
||||||
|
|
||||||
this->EmitUniversalBinaryFlags = true;
|
this->EmitUniversalBinaryFlags = true;
|
||||||
this->BackwardsCompatibility = 0;
|
this->BackwardsCompatibility = 0;
|
||||||
this->BackwardsCompatibilityFinal = false;
|
this->BackwardsCompatibilityFinal = false;
|
||||||
|
@ -453,11 +455,45 @@ void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt)
|
||||||
this->GeneratorTargets.push_back(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(
|
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTarget(
|
||||||
const std::string& name) const
|
const std::string& name) const
|
||||||
{
|
{
|
||||||
return this->GetGlobalGenerator()->GetGeneratorTarget(
|
std::map<std::string, std::string>::const_iterator i =
|
||||||
this->Makefile->FindTarget(name));
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -373,6 +373,7 @@ protected:
|
||||||
|
|
||||||
std::set<cmGeneratorTarget const*> WarnCMP0063;
|
std::set<cmGeneratorTarget const*> WarnCMP0063;
|
||||||
std::vector<cmGeneratorTarget*> GeneratorTargets;
|
std::vector<cmGeneratorTarget*> GeneratorTargets;
|
||||||
|
std::map<std::string, std::string> AliasTargets;
|
||||||
|
|
||||||
bool EmitUniversalBinaryFlags;
|
bool EmitUniversalBinaryFlags;
|
||||||
|
|
||||||
|
|
|
@ -400,6 +400,11 @@ public:
|
||||||
bool excludeAliases = false) const;
|
bool excludeAliases = false) const;
|
||||||
bool IsAlias(const std::string& name) 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.
|
* Mark include directories as system directories.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue