Search generator in cmake::ExtraGenerators before in cmake::Generators

Since ExtraGenerators does not contain items, which are in Generators
too, there is not change in behaviour. The benefit of this change is,
that the lookup in the Generators map is now only done once.
This commit is contained in:
Patrick Gansterer 2012-11-19 15:56:31 +01:00 committed by Brad King
parent 30a695021c
commit 984ebc3350
1 changed files with 22 additions and 19 deletions

View File

@ -1889,29 +1889,32 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name)
{
cmGlobalGenerator* generator = 0;
cmExternalMakefileProjectGenerator* extraGenerator = 0;
RegisteredGeneratorsMap::const_iterator genIt = this->Generators.find(name);
if(genIt == this->Generators.end())
RegisteredExtraGeneratorsMap::const_iterator extraGenIt =
this->ExtraGenerators.find(name);
if (extraGenIt != this->ExtraGenerators.end())
{
RegisteredExtraGeneratorsMap::const_iterator extraGenIt =
this->ExtraGenerators.find(name);
if (extraGenIt == this->ExtraGenerators.end())
{
return 0;
}
extraGenerator = (extraGenIt->second)();
genIt=this->Generators.find(extraGenerator->GetGlobalGeneratorName(name));
if(genIt == this->Generators.end())
{
delete extraGenerator;
return 0;
}
}
name = extraGenerator->GetGlobalGeneratorName(name);
}
cmGlobalGenerator* generator = 0;
RegisteredGeneratorsMap::const_iterator genIt = this->Generators.find(name);
if(genIt != this->Generators.end())
{
generator = genIt->second->CreateGlobalGenerator();
}
if (generator)
{
generator->SetCMakeInstance(this);
generator->SetExternalMakefileProjectGenerator(extraGenerator);
}
else
{
delete extraGenerator;
}
generator = genIt->second->CreateGlobalGenerator();
generator->SetCMakeInstance(this);
generator->SetExternalMakefileProjectGenerator(extraGenerator);
return generator;
}