cmGlobalGenerator: Add NVI wrapper to create local generator.

This commit is contained in:
Stephen Kelly 2015-05-16 05:18:25 +02:00
parent 2e4ea0c055
commit b659d161da
14 changed files with 26 additions and 18 deletions

View File

@ -715,7 +715,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
std::string realInstallDirectory = tempInstallDirectory;
if ( !installSubDirectory.empty() && installSubDirectory != "/" )

View File

@ -201,7 +201,7 @@ int main (int argc, char const* const* argv)
cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg;
cmgg.SetCMakeInstance(&cminst);
cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.MakeLocalGenerator());
cmMakefile* globalMF = cmlg->GetMakefile();
#if defined(__CYGWIN__)
globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");

View File

@ -752,7 +752,7 @@ void cmCTestLaunch::LoadConfig()
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile* mf = lg->GetMakefile();
std::string fname = this->LogDir;
fname += "CTestLaunchConfig.cmake";

View File

@ -340,7 +340,7 @@ void cmCTestScriptHandler::CreateCMake()
this->GlobalGenerator = new cmGlobalGenerator;
this->GlobalGenerator->SetCMakeInstance(this->CMake);
this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator();
this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator();
this->Makefile = this->LocalGenerator->GetMakefile();
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);

View File

@ -1573,7 +1573,7 @@ void cmCTestTestHandler::GetListOfTests()
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str());

View File

@ -512,7 +512,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )
{

View File

@ -1099,7 +1099,7 @@ void cmGlobalGenerator::Configure()
this->ClearGeneratorMembers();
// start with this directory
cmLocalGenerator *lg = this->CreateLocalGenerator();
cmLocalGenerator *lg = this->MakeLocalGenerator();
this->LocalGenerators.push_back(lg);
// set the Start directories
@ -1881,6 +1881,12 @@ void cmGlobalGenerator::EnableInstallTarget()
this->InstallTargetEnabled = true;
}
cmLocalGenerator *
cmGlobalGenerator::MakeLocalGenerator(cmLocalGenerator *parent)
{
return this->CreateLocalGenerator(parent);
}
cmLocalGenerator *
cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent)
{

View File

@ -52,8 +52,7 @@ public:
cmGlobalGenerator();
virtual ~cmGlobalGenerator();
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0);
cmLocalGenerator* MakeLocalGenerator(cmLocalGenerator* parent = 0);
///! Get the name for this generator
virtual std::string GetName() const { return "Generic"; }
@ -442,6 +441,9 @@ protected:
virtual bool UseFolderProperty();
private:
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent);
cmMakefile* TryCompileOuterMakefile;
float FirstTimeProgress;
// If you add a new map here, make sure it is copied

View File

@ -580,7 +580,7 @@ void cmGlobalUnixMakefileGenerator3
else
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->CreateLocalGenerator());
(this->MakeLocalGenerator());
// set the Start directories
lg->GetMakefile()->SetCurrentSourceDirectory
(this->CMakeInstance->GetHomeDirectory());

View File

@ -67,7 +67,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cmake cm;
cmGlobalGenerator ggi;
ggi.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> lg(ggi.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile();
const char* inFileName = settingsFileName;

View File

@ -1706,7 +1706,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
// create a new local generator and set its parent
cmLocalGenerator *lg2 = this->GetGlobalGenerator()
->CreateLocalGenerator(this->LocalGenerator);
->MakeLocalGenerator(this->LocalGenerator);
this->GetGlobalGenerator()->AddLocalGenerator(lg2);
// set the subdirs start dirs

View File

@ -1212,7 +1212,7 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
cm->SetHomeOutputDirectory(targetDirectory);
cm->SetHomeDirectory(targetDirectory);
cmLocalGenerator* lg = gg->CreateLocalGenerator();
cmLocalGenerator* lg = gg->MakeLocalGenerator();
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
gg->SetCurrentLocalGenerator(lg);

View File

@ -376,7 +376,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
std::string homeOutputDir = this->GetHomeOutputDirectory();
this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator());
lg->GetMakefile()->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
lg->GetMakefile()->SetCurrentSourceDirectory
@ -418,7 +418,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
this->SetGlobalGenerator(gg);
// read in the list file to fill the cache
cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator());
cmMakefile* mf = lg->GetMakefile();
mf->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
@ -1927,7 +1927,7 @@ int cmake::CheckBuildSystem()
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile* mf = lg->GetMakefile();
if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
@ -1957,7 +1957,7 @@ int cmake::CheckBuildSystem()
ggd(this->CreateGlobalGenerator(genName));
if(ggd.get())
{
cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator());
lgd->ClearDependencies(mf, verbose);
}
}

View File

@ -646,7 +646,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen))
{
cm.SetGlobalGenerator(ggd);
cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator());
lgd->GetMakefile()->SetCurrentSourceDirectory(startDir);
lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir);