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->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<float>(i)+1.0f)/
static_cast<float>(this->LocalGenerators.size()));
}
this->SetCurrentLocalGenerator(0);
this->SetCurrentMakefile(0);
if(!this->GenerateCPackPropertiesFile())
{

View File

@ -168,11 +168,13 @@ public:
const std::vector<cmLocalGenerator *>& 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<cmLocalGenerator *> LocalGenerators;
cmLocalGenerator* CurrentLocalGenerator;
cmMakefile* CurrentMakefile;
// map from project name to vector of local generators in that project
std::map<std::string, std::vector<cmLocalGenerator*> > ProjectMap;
std::map<cmLocalGenerator*, std::set<cmTarget const*> >

View File

@ -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<void>(clg);
// make sure the CMakeFiles dir is there

View File

@ -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);

View File

@ -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;