|
|
@@ -1649,6 +1649,8 @@ void cmGlobalGenerator::ClearGeneratorMembers()
|
|
|
|
|
|
this->ExportSets.clear();
|
|
|
this->TargetDependencies.clear();
|
|
|
+ this->TargetSearchIndex.clear();
|
|
|
+ this->GeneratorTargetSearchIndex.clear();
|
|
|
this->ProjectMap.clear();
|
|
|
this->RuleHashes.clear();
|
|
|
this->DirectoryContentMap.clear();
|
|
|
@@ -2177,75 +2179,40 @@ bool cmGlobalGenerator::IsAlias(const std::string& name) const
|
|
|
return this->AliasTargets.find(name) != this->AliasTargets.end();
|
|
|
}
|
|
|
|
|
|
-cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const
|
|
|
+void cmGlobalGenerator::IndexTarget(cmTarget* t)
|
|
|
{
|
|
|
- for (unsigned int i = 0; i < this->Makefiles.size(); ++i)
|
|
|
+ if (!t->IsImported() || t->IsImportedGloballyVisible())
|
|
|
{
|
|
|
- cmTargets& tgts = this->Makefiles[i]->GetTargets();
|
|
|
- for (cmTargets::iterator it = tgts.begin(); it != tgts.end(); ++it)
|
|
|
- {
|
|
|
- if (it->second.GetName() == name)
|
|
|
- {
|
|
|
- return &it->second;
|
|
|
- }
|
|
|
- }
|
|
|
+ this->TargetSearchIndex[t->GetName()] = t;
|
|
|
}
|
|
|
- return 0;
|
|
|
}
|
|
|
|
|
|
-cmGeneratorTarget*
|
|
|
-cmGlobalGenerator::FindGeneratorTargetImpl(std::string const& name) const
|
|
|
+void cmGlobalGenerator::IndexGeneratorTarget(cmGeneratorTarget* gt)
|
|
|
{
|
|
|
- for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
|
|
+ if (!gt->IsImported() || gt->IsImportedGloballyVisible())
|
|
|
{
|
|
|
- const std::vector<cmGeneratorTarget*>& tgts =
|
|
|
- this->LocalGenerators[i]->GetGeneratorTargets();
|
|
|
- for (std::vector<cmGeneratorTarget*>::const_iterator it = tgts.begin();
|
|
|
- it != tgts.end(); ++it)
|
|
|
- {
|
|
|
- if ((*it)->GetName() == name)
|
|
|
- {
|
|
|
- return *it;
|
|
|
- }
|
|
|
- }
|
|
|
+ this->GeneratorTargetSearchIndex[gt->GetName()] = gt;
|
|
|
}
|
|
|
- return 0;
|
|
|
}
|
|
|
|
|
|
-cmTarget*
|
|
|
-cmGlobalGenerator::FindImportedTargetImpl(std::string const& name) const
|
|
|
+cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const
|
|
|
{
|
|
|
- for (unsigned int i = 0; i < this->Makefiles.size(); ++i)
|
|
|
+ TargetMap::const_iterator i = this->TargetSearchIndex.find(name);
|
|
|
+ if (i != this->TargetSearchIndex.end())
|
|
|
{
|
|
|
- const std::vector<cmTarget*>& tgts =
|
|
|
- this->Makefiles[i]->GetOwnedImportedTargets();
|
|
|
- for (std::vector<cmTarget*>::const_iterator it = tgts.begin();
|
|
|
- it != tgts.end(); ++it)
|
|
|
- {
|
|
|
- if ((*it)->GetName() == name && (*it)->IsImportedGloballyVisible())
|
|
|
- {
|
|
|
- return *it;
|
|
|
- }
|
|
|
- }
|
|
|
+ return i->second;
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-cmGeneratorTarget* cmGlobalGenerator::FindImportedGeneratorTargetImpl(
|
|
|
- std::string const& name) const
|
|
|
+cmGeneratorTarget*
|
|
|
+cmGlobalGenerator::FindGeneratorTargetImpl(std::string const& name) const
|
|
|
{
|
|
|
- for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
|
|
+ GeneratorTargetMap::const_iterator i =
|
|
|
+ this->GeneratorTargetSearchIndex.find(name);
|
|
|
+ if (i != this->GeneratorTargetSearchIndex.end())
|
|
|
{
|
|
|
- const std::vector<cmGeneratorTarget*>& tgts =
|
|
|
- this->LocalGenerators[i]->GetImportedGeneratorTargets();
|
|
|
- for (std::vector<cmGeneratorTarget*>::const_iterator it = tgts.begin();
|
|
|
- it != tgts.end(); ++it)
|
|
|
- {
|
|
|
- if ((*it)->IsImportedGloballyVisible() && (*it)->GetName() == name)
|
|
|
- {
|
|
|
- return *it;
|
|
|
- }
|
|
|
- }
|
|
|
+ return i->second;
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -2264,11 +2231,7 @@ cmGlobalGenerator::FindTarget(const std::string& name,
|
|
|
return this->FindTargetImpl(ai->second);
|
|
|
}
|
|
|
}
|
|
|
- if (cmTarget* tgt = this->FindTargetImpl(name))
|
|
|
- {
|
|
|
- return tgt;
|
|
|
- }
|
|
|
- return this->FindImportedTargetImpl(name);
|
|
|
+ return this->FindTargetImpl(name);
|
|
|
}
|
|
|
|
|
|
cmGeneratorTarget*
|
|
|
@@ -2280,11 +2243,7 @@ cmGlobalGenerator::FindGeneratorTarget(const std::string& name) const
|
|
|
{
|
|
|
return this->FindGeneratorTargetImpl(ai->second);
|
|
|
}
|
|
|
- if (cmGeneratorTarget* tgt = this->FindGeneratorTargetImpl(name))
|
|
|
- {
|
|
|
- return tgt;
|
|
|
- }
|
|
|
- return this->FindImportedGeneratorTargetImpl(name);
|
|
|
+ return this->FindGeneratorTargetImpl(name);
|
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|