From b659d161da3c488890e32fbb1acf1295186d3c4f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 16 May 2015 05:18:25 +0200 Subject: [PATCH] cmGlobalGenerator: Add NVI wrapper to create local generator. --- Source/CPack/cmCPackGenerator.cxx | 2 +- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 2 +- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/cmCTest.cxx | 2 +- Source/cmGlobalGenerator.cxx | 8 +++++++- Source/cmGlobalGenerator.h | 6 ++++-- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGraphVizWriter.cxx | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmake.cxx | 8 ++++---- Source/cmcmd.cxx | 2 +- 14 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index e254e9a84..6e30f8cba 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -715,7 +715,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr lg(gg.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); std::string realInstallDirectory = tempInstallDirectory; if ( !installSubDirectory.empty() && installSubDirectory != "/" ) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2207873aa..29484cf36 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -201,7 +201,7 @@ int main (int argc, char const* const* argv) cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); - cmsys::auto_ptr cmlg(cmgg.CreateLocalGenerator()); + cmsys::auto_ptr cmlg(cmgg.MakeLocalGenerator()); cmMakefile* globalMF = cmlg->GetMakefile(); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index de6ecde3a..d3edc80e0 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -752,7 +752,7 @@ void cmCTestLaunch::LoadConfig() cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr lg(gg.MakeLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 0a34be88e..7ee9d851f 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -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); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 95cdf3b51..5d40f9135 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1573,7 +1573,7 @@ void cmCTestTestHandler::GetListOfTests() cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr lg(gg.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); mf->AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType().c_str()); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 403a45937..f3c4da5eb 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -512,7 +512,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - cmsys::auto_ptr lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr lg(gg.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) ) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1c9c475ff..cf9e6e601 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 3b2a41f66..9ac741db9 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -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 diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a4df493a0..181f4c0af 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -580,7 +580,7 @@ void cmGlobalUnixMakefileGenerator3 else { lg = static_cast - (this->CreateLocalGenerator()); + (this->MakeLocalGenerator()); // set the Start directories lg->GetMakefile()->SetCurrentSourceDirectory (this->CMakeInstance->GetHomeDirectory()); diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 99542a904..7cad8a15d 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -67,7 +67,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, cmake cm; cmGlobalGenerator ggi; ggi.SetCMakeInstance(&cm); - cmsys::auto_ptr lg(ggi.CreateLocalGenerator()); + cmsys::auto_ptr lg(ggi.MakeLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); const char* inFileName = settingsFileName; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7b8d3afa5..2d855eef3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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 diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 457de1185..983f234a9 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -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); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5c5c42824..c5a98d540 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -376,7 +376,7 @@ void cmake::ReadListFile(const std::vector& args, std::string homeOutputDir = this->GetHomeOutputDirectory(); this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); - cmsys::auto_ptr lg(gg->CreateLocalGenerator()); + cmsys::auto_ptr lg(gg->MakeLocalGenerator()); lg->GetMakefile()->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetCurrentSourceDirectory @@ -418,7 +418,7 @@ bool cmake::FindPackage(const std::vector& args) this->SetGlobalGenerator(gg); // read in the list file to fill the cache - cmsys::auto_ptr lg(gg->CreateLocalGenerator()); + cmsys::auto_ptr 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 lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr 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 lgd(ggd->CreateLocalGenerator()); + cmsys::auto_ptr lgd(ggd->MakeLocalGenerator()); lgd->ClearDependencies(mf, verbose); } } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 12bb8ee5e..3400625f4 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -646,7 +646,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) { cm.SetGlobalGenerator(ggd); - cmsys::auto_ptr lgd(ggd->CreateLocalGenerator()); + cmsys::auto_ptr lgd(ggd->MakeLocalGenerator()); lgd->GetMakefile()->SetCurrentSourceDirectory(startDir); lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir);