diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7552c994d01a9a97b3f77f809c4a77343cb4f1a2..46ef2f3c9b6de9c84ab109e38c71ea069184b078 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1091,6 +1091,18 @@ void cmGlobalGenerator::ClearEnabledLanguages() return this->CMakeInstance->GetState()->ClearEnabledLanguages(); } +void cmGlobalGenerator::CreateLocalGenerators() +{ + cmDeleteAll(this->LocalGenerators); + this->LocalGenerators.clear(); + this->LocalGenerators.reserve(this->Makefiles.size()); + for (std::vector<cmMakefile*>::const_iterator it = this->Makefiles.begin(); + it != this->Makefiles.end(); ++it) + { + this->LocalGenerators.push_back(this->CreateLocalGenerator(*it)); + } +} + void cmGlobalGenerator::Configure() { this->FirstTimeProgress = 0.0f; @@ -1112,8 +1124,7 @@ void cmGlobalGenerator::Configure() // now do it this->ConfigureDoneCMP0026 = false; dirMf->Configure(); - this->LocalGenerators.insert(this->LocalGenerators.begin(), - this->CreateLocalGenerator(dirMf)); + this->CreateLocalGenerators(); dirMf->EnforceDirectoryLevelRules(); this->ConfigureDoneCMP0026 = true; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 40f98dc82421d2a9f6a2e20cec40205ce58ed17d..b2dffcc947467296e7c9d15a0d0d3a1f8796241b 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -466,6 +466,8 @@ private: virtual void ForceLinkerLanguages(); + void CreateLocalGenerators(); + void CheckCompilerIdCompatibility(cmMakefile* mf, std::string const& lang) const; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 720a5e45b1a4dd3119f88f94f8500fa944306f24..64806672753a26d2e604ff1e423d0ca4e8dd5f59 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1772,11 +1772,6 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, { this->UnConfiguredDirectories.push_back(subMf); } - - // create a new local generator and set its parent - cmLocalGenerator *lg2 = this->GetGlobalGenerator() - ->CreateLocalGenerator(subMf); - this->GetGlobalGenerator()->AddLocalGenerator(lg2); } void cmMakefile::SetCurrentSourceDirectory(const std::string& dir)