diff options
author | Patrick Gansterer <paroga@paroga.com> | 2012-11-19 14:56:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-11-19 17:54:34 (GMT) |
commit | 984ebc3350f72cb005999f7b796803f83be15304 (patch) | |
tree | 061686dbd57618f7c35a6d626638eef30b72d029 /Source | |
parent | 30a695021ccc6583493b3e7f9992ad428cd2855f (diff) | |
download | CMake-984ebc3350f72cb005999f7b796803f83be15304.zip CMake-984ebc3350f72cb005999f7b796803f83be15304.tar.gz CMake-984ebc3350f72cb005999f7b796803f83be15304.tar.bz2 |
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.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmake.cxx | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2d531ba..cd71507 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -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; } |