Merge topic 'clean-up-cmQtAutoGenerators'

a5b59fae QtAutogen: Create global generator on the stack.
fe401ede QtAutogen: Use a more-obvious delete-target.
c95a55ad QtAutogen: Remove the need for a local makefile variable.
460e8fb9 QtAutogen: Inline static factory method.
58f41c78 QtAutogen: Remove repeated setters.
This commit is contained in:
Brad King 2015-05-21 09:03:46 -04:00 committed by CMake Topic Stage
commit e604bb1be9
1 changed files with 11 additions and 26 deletions

View File

@ -1203,23 +1203,6 @@ std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target)
return std::string();
}
static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
const std::string& targetDirectory)
{
cmGlobalGenerator* gg = new cmGlobalGenerator();
gg->SetCMakeInstance(cm);
cm->SetHomeOutputDirectory(targetDirectory);
cm->SetHomeDirectory(targetDirectory);
cmLocalGenerator* lg = gg->MakeLocalGenerator();
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
gg->SetCurrentLocalGenerator(lg);
return gg;
}
bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
const std::string& config)
{
@ -1227,25 +1210,27 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cmake cm;
cm.SetHomeOutputDirectory(targetDirectory);
cm.SetHomeDirectory(targetDirectory);
cmGlobalGenerator* gg = CreateGlobalGenerator(&cm, targetDirectory);
cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile();
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
this->ReadAutogenInfoFile(makefile, targetDirectory, config);
this->ReadOldMocDefinitionsFile(makefile, targetDirectory);
cmLocalGenerator* lg = gg.MakeLocalGenerator();
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
gg.SetCurrentLocalGenerator(lg);
this->ReadAutogenInfoFile(lg->GetMakefile(), targetDirectory, config);
this->ReadOldMocDefinitionsFile(lg->GetMakefile(), targetDirectory);
this->Init();
if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5")
{
success = this->RunAutogen(makefile);
success = this->RunAutogen(lg->GetMakefile());
}
this->WriteOldMocDefinitionsFile(targetDirectory);
delete gg->GetCurrentLocalGenerator();
delete gg;
gg = NULL;
makefile = NULL;
delete lg;
return success;
}