cmake: Replace CurrentLocalGenerator concept with CurrentMakefile.

This commit is contained in:
Stephen Kelly 2015-05-30 23:50:28 +02:00 committed by Brad King
parent 69a038a9e9
commit a653611db0
5 changed files with 21 additions and 23 deletions

View File

@ -70,7 +70,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
this->TryCompileTimeout = 0; this->TryCompileTimeout = 0;
this->ExtraGenerator = 0; this->ExtraGenerator = 0;
this->CurrentLocalGenerator = 0; this->CurrentMakefile = 0;
this->TryCompileOuterMakefile = 0; this->TryCompileOuterMakefile = 0;
} }
@ -1281,7 +1281,7 @@ void cmGlobalGenerator::Generate()
// Generate project files // Generate project files
for (i = 0; i < this->LocalGenerators.size(); ++i) for (i = 0; i < this->LocalGenerators.size(); ++i)
{ {
this->SetCurrentLocalGenerator(this->LocalGenerators[i]); this->SetCurrentMakefile(this->LocalGenerators[i]->GetMakefile());
this->LocalGenerators[i]->Generate(); this->LocalGenerators[i]->Generate();
if(!this->LocalGenerators[i]->GetMakefile()->IsOn( if(!this->LocalGenerators[i]->GetMakefile()->IsOn(
"CMAKE_SKIP_INSTALL_RULES")) "CMAKE_SKIP_INSTALL_RULES"))
@ -1293,7 +1293,7 @@ void cmGlobalGenerator::Generate()
(static_cast<float>(i)+1.0f)/ (static_cast<float>(i)+1.0f)/
static_cast<float>(this->LocalGenerators.size())); static_cast<float>(this->LocalGenerators.size()));
} }
this->SetCurrentLocalGenerator(0); this->SetCurrentMakefile(0);
if(!this->GenerateCPackPropertiesFile()) if(!this->GenerateCPackPropertiesFile())
{ {

View File

@ -168,11 +168,13 @@ public:
const std::vector<cmLocalGenerator *>& GetLocalGenerators() const { const std::vector<cmLocalGenerator *>& GetLocalGenerators() const {
return this->LocalGenerators;} return this->LocalGenerators;}
cmLocalGenerator* GetCurrentLocalGenerator() cmMakefile* GetCurrentMakefile() const
{return this->CurrentLocalGenerator;} {
return this->CurrentMakefile;
}
void SetCurrentLocalGenerator(cmLocalGenerator* lg) void SetCurrentMakefile(cmMakefile* mf)
{this->CurrentLocalGenerator = lg;} {this->CurrentMakefile = mf;}
void AddLocalGenerator(cmLocalGenerator *lg); void AddLocalGenerator(cmLocalGenerator *lg);
@ -406,7 +408,7 @@ protected:
std::string ConfiguredFilesPath; std::string ConfiguredFilesPath;
cmake *CMakeInstance; cmake *CMakeInstance;
std::vector<cmLocalGenerator *> LocalGenerators; std::vector<cmLocalGenerator *> LocalGenerators;
cmLocalGenerator* CurrentLocalGenerator; cmMakefile* CurrentMakefile;
// map from project name to vector of local generators in that project // map from project name to vector of local generators in that project
std::map<std::string, std::vector<cmLocalGenerator*> > ProjectMap; std::map<std::string, std::vector<cmLocalGenerator*> > ProjectMap;
std::map<cmLocalGenerator*, std::set<cmTarget const*> > std::map<cmLocalGenerator*, std::set<cmTarget const*> >

View File

@ -78,16 +78,17 @@ bool cmLocalGenerator::IsRootMakefile() const
class cmLocalGeneratorCurrent class cmLocalGeneratorCurrent
{ {
cmGlobalGenerator* GG; cmGlobalGenerator* GG;
cmLocalGenerator* LG; cmMakefile* MF;
cmState::Snapshot Snapshot; cmState::Snapshot Snapshot;
public: public:
cmLocalGeneratorCurrent(cmLocalGenerator* lg) cmLocalGeneratorCurrent(cmMakefile* mf)
{ {
this->GG = lg->GetGlobalGenerator(); this->GG = mf->GetGlobalGenerator();
this->LG = this->GG->GetCurrentLocalGenerator(); this->MF = this->GG->GetCurrentMakefile();
this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot();
this->GG->GetCMakeInstance()->SetCurrentSnapshot(lg->GetStateSnapshot()); this->GG->GetCMakeInstance()->SetCurrentSnapshot(
this->GG->SetCurrentLocalGenerator(lg); this->GG->GetCMakeInstance()->GetCurrentSnapshot());
this->GG->SetCurrentMakefile(mf);
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
this->GG->GetFileLockPool().PushFileScope(); this->GG->GetFileLockPool().PushFileScope();
#endif #endif
@ -97,7 +98,7 @@ public:
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
this->GG->GetFileLockPool().PopFileScope(); this->GG->GetFileLockPool().PopFileScope();
#endif #endif
this->GG->SetCurrentLocalGenerator(this->LG); this->GG->SetCurrentMakefile(this->MF);
this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot);
} }
}; };
@ -106,7 +107,7 @@ public:
void cmLocalGenerator::Configure() void cmLocalGenerator::Configure()
{ {
// Manage the global generator's current local generator. // Manage the global generator's current local generator.
cmLocalGeneratorCurrent clg(this); cmLocalGeneratorCurrent clg(this->GetMakefile());
static_cast<void>(clg); static_cast<void>(clg);
// make sure the CMakeFiles dir is there // make sure the CMakeFiles dir is there

View File

@ -1215,7 +1215,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cmLocalGenerator* lg = gg.MakeLocalGenerator(); cmLocalGenerator* lg = gg.MakeLocalGenerator();
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
gg.SetCurrentLocalGenerator(lg); gg.SetCurrentMakefile(lg->GetMakefile());
this->ReadAutogenInfoFile(lg->GetMakefile(), targetDirectory, config); this->ReadAutogenInfoFile(lg->GetMakefile(), targetDirectory, config);
this->ReadOldMocDefinitionsFile(lg->GetMakefile(), targetDirectory); this->ReadOldMocDefinitionsFile(lg->GetMakefile(), targetDirectory);

View File

@ -113,12 +113,7 @@ static cmMakefile* cmakemainGetMakefile(void *clientdata)
cmGlobalGenerator* gg=cm->GetGlobalGenerator(); cmGlobalGenerator* gg=cm->GetGlobalGenerator();
if (gg) if (gg)
{ {
cmLocalGenerator* lg=gg->GetCurrentLocalGenerator(); return gg->GetCurrentMakefile();
if (lg)
{
cmMakefile* mf = lg->GetMakefile();
return mf;
}
} }
} }
return 0; return 0;