From a653611db0d6e23456c5ef90f95e19ea5d70a428 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 30 May 2015 23:50:28 +0200 Subject: [PATCH] cmake: Replace CurrentLocalGenerator concept with CurrentMakefile. --- Source/cmGlobalGenerator.cxx | 6 +++--- Source/cmGlobalGenerator.h | 12 +++++++----- Source/cmLocalGenerator.cxx | 17 +++++++++-------- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmakemain.cxx | 7 +------ 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d1842c1aa..1ee550069 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -70,7 +70,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->TryCompileTimeout = 0; this->ExtraGenerator = 0; - this->CurrentLocalGenerator = 0; + this->CurrentMakefile = 0; this->TryCompileOuterMakefile = 0; } @@ -1281,7 +1281,7 @@ void cmGlobalGenerator::Generate() // Generate project files for (i = 0; i < this->LocalGenerators.size(); ++i) { - this->SetCurrentLocalGenerator(this->LocalGenerators[i]); + this->SetCurrentMakefile(this->LocalGenerators[i]->GetMakefile()); this->LocalGenerators[i]->Generate(); if(!this->LocalGenerators[i]->GetMakefile()->IsOn( "CMAKE_SKIP_INSTALL_RULES")) @@ -1293,7 +1293,7 @@ void cmGlobalGenerator::Generate() (static_cast(i)+1.0f)/ static_cast(this->LocalGenerators.size())); } - this->SetCurrentLocalGenerator(0); + this->SetCurrentMakefile(0); if(!this->GenerateCPackPropertiesFile()) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 979e97103..d2b850432 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -168,11 +168,13 @@ public: const std::vector& GetLocalGenerators() const { return this->LocalGenerators;} - cmLocalGenerator* GetCurrentLocalGenerator() - {return this->CurrentLocalGenerator;} + cmMakefile* GetCurrentMakefile() const + { + return this->CurrentMakefile; + } - void SetCurrentLocalGenerator(cmLocalGenerator* lg) - {this->CurrentLocalGenerator = lg;} + void SetCurrentMakefile(cmMakefile* mf) + {this->CurrentMakefile = mf;} void AddLocalGenerator(cmLocalGenerator *lg); @@ -406,7 +408,7 @@ protected: std::string ConfiguredFilesPath; cmake *CMakeInstance; std::vector LocalGenerators; - cmLocalGenerator* CurrentLocalGenerator; + cmMakefile* CurrentMakefile; // map from project name to vector of local generators in that project std::map > ProjectMap; std::map > diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 58366d1a9..4b9415b95 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -78,16 +78,17 @@ bool cmLocalGenerator::IsRootMakefile() const class cmLocalGeneratorCurrent { cmGlobalGenerator* GG; - cmLocalGenerator* LG; + cmMakefile* MF; cmState::Snapshot Snapshot; public: - cmLocalGeneratorCurrent(cmLocalGenerator* lg) + cmLocalGeneratorCurrent(cmMakefile* mf) { - this->GG = lg->GetGlobalGenerator(); - this->LG = this->GG->GetCurrentLocalGenerator(); + this->GG = mf->GetGlobalGenerator(); + this->MF = this->GG->GetCurrentMakefile(); this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); - this->GG->GetCMakeInstance()->SetCurrentSnapshot(lg->GetStateSnapshot()); - this->GG->SetCurrentLocalGenerator(lg); + this->GG->GetCMakeInstance()->SetCurrentSnapshot( + this->GG->GetCMakeInstance()->GetCurrentSnapshot()); + this->GG->SetCurrentMakefile(mf); #if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PushFileScope(); #endif @@ -97,7 +98,7 @@ public: #if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PopFileScope(); #endif - this->GG->SetCurrentLocalGenerator(this->LG); + this->GG->SetCurrentMakefile(this->MF); this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); } }; @@ -106,7 +107,7 @@ public: void cmLocalGenerator::Configure() { // Manage the global generator's current local generator. - cmLocalGeneratorCurrent clg(this); + cmLocalGeneratorCurrent clg(this->GetMakefile()); static_cast(clg); // make sure the CMakeFiles dir is there diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index cbb06cde3..fbd294690 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1215,7 +1215,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, cmLocalGenerator* lg = gg.MakeLocalGenerator(); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); - gg.SetCurrentLocalGenerator(lg); + gg.SetCurrentMakefile(lg->GetMakefile()); this->ReadAutogenInfoFile(lg->GetMakefile(), targetDirectory, config); this->ReadOldMocDefinitionsFile(lg->GetMakefile(), targetDirectory); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index e5f4700b7..cc3073251 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -113,12 +113,7 @@ static cmMakefile* cmakemainGetMakefile(void *clientdata) cmGlobalGenerator* gg=cm->GetGlobalGenerator(); if (gg) { - cmLocalGenerator* lg=gg->GetCurrentLocalGenerator(); - if (lg) - { - cmMakefile* mf = lg->GetMakefile(); - return mf; - } + return gg->GetCurrentMakefile(); } } return 0;