From efcca9353f9af919625727a68b2f9c77995aed7f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 3 May 2015 11:05:27 +0200 Subject: [PATCH 1/6] cmMakefile: Simplify GetCMakeInstance implementation. No callers handle the possibility that it can return null, and that is no longer possible anyway. --- Source/cmMakefile.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5686b1b0d..925554b39 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3693,11 +3693,7 @@ bool cmMakefile::GetIsSourceFileTryCompile() const cmake *cmMakefile::GetCMakeInstance() const { - if ( this->LocalGenerator && this->LocalGenerator->GetGlobalGenerator() ) - { - return this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance(); - } - return 0; + return this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance(); } #ifdef CMAKE_BUILD_WITH_CMAKE From e1bdf5f5b2b15908b9f1c0486da45167933456f3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 3 May 2015 11:41:29 +0200 Subject: [PATCH 2/6] cmMakefile: Use GetCMakeInstance. --- Source/cmMakefile.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 925554b39..cee5bd0e5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3727,8 +3727,7 @@ cmState *cmMakefile::GetState() const void cmMakefile::DisplayStatus(const char* message, float s) const { - cmake* cm = this->GetLocalGenerator()->GetGlobalGenerator() - ->GetCMakeInstance(); + cmake* cm = this->GetCMakeInstance(); if (cm->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) { // don't output any STATUS message in FIND_PACKAGE_MODE, since they will @@ -4570,8 +4569,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, // The conflict is with a non-imported target. // Allow this if the user has requested support. - cmake* cm = - this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance(); + cmake* cm = this->GetCMakeInstance(); if(isCustom && existing->GetType() == cmTarget::UTILITY && this != existing->GetMakefile() && cm->GetState() From 0bb6dbe0c62f027af394f680f644041cfad7321f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 3 May 2015 11:08:21 +0200 Subject: [PATCH 3/6] cmMakefile: Extract an accessor for the global generator. Both for convenience, and because cmMakefile should not be the way to get access to the local generator, so that should go away in the future. --- Source/cmMakefile.cxx | 7 ++++++- Source/cmMakefile.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cee5bd0e5..699c0ef64 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3693,7 +3693,12 @@ bool cmMakefile::GetIsSourceFileTryCompile() const cmake *cmMakefile::GetCMakeInstance() const { - return this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance(); + return this->GetGlobalGenerator()->GetCMakeInstance(); +} + +cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const +{ + return this->LocalGenerator->GetGlobalGenerator(); } #ifdef CMAKE_BUILD_WITH_CMAKE diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8968e81ff..ad098ef31 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -712,6 +712,7 @@ public: * Get the instance */ cmake *GetCMakeInstance() const; + cmGlobalGenerator* GetGlobalGenerator() const; /** * Get all the source files this makefile knows about From 040491fc586d34fe467907eefc85b1524c7cea1e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 3 May 2015 11:31:46 +0200 Subject: [PATCH 4/6] cmComputeLinkDepends: Remove unused local generator. --- Source/cmComputeLinkDepends.cxx | 4 +--- Source/cmComputeLinkDepends.h | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 6005d5fe5..abd987767 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -13,7 +13,6 @@ #include "cmComputeComponentGraph.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" @@ -179,8 +178,7 @@ cmComputeLinkDepends // Store context information. this->Target = target; this->Makefile = this->Target->GetMakefile(); - this->LocalGenerator = this->Makefile->GetLocalGenerator(); - this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); + this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); // The configuration being linked. diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index a931726d9..09b9d7053 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -21,7 +21,6 @@ class cmComputeComponentGraph; class cmGlobalGenerator; -class cmLocalGenerator; class cmMakefile; class cmTarget; class cmake; @@ -60,7 +59,6 @@ private: // Context information. cmTarget const* Target; cmMakefile* Makefile; - cmLocalGenerator* LocalGenerator; cmGlobalGenerator const* GlobalGenerator; cmake* CMakeInstance; bool DebugMode; From cbf143bb76604f576275d96a1e1e4c701680ff29 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 3 May 2015 11:33:08 +0200 Subject: [PATCH 5/6] cmComputeTargetDepends: Use simpler global generator access. --- Source/cmComputeTargetDepends.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 11056cd8e..d26984c94 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -216,9 +216,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // deal with config-specific dependencies. { std::set emitted; - cmGeneratorTarget* gt = depender->GetMakefile()->GetLocalGenerator() - ->GetGlobalGenerator() - ->GetGeneratorTarget(depender); + cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(depender); std::vector configs; depender->GetMakefile()->GetConfigurations(configs); From a0836ed97804952ace98d2c1d0d46e968a532a3c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 3 May 2015 11:10:30 +0200 Subject: [PATCH 6/6] Port to cmMakefile::GetGlobalGenerator. --- Source/cmBuildCommand.cxx | 10 ++- Source/cmComputeLinkInformation.cxx | 2 +- Source/cmExportBuildFileGenerator.cxx | 2 +- Source/cmExportCommand.cxx | 3 +- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmFileCommand.cxx | 7 +-- Source/cmFindLibraryCommand.cxx | 2 +- .../cmGeneratorExpressionEvaluationFile.cxx | 6 +- Source/cmGeneratorExpressionNode.cxx | 3 +- Source/cmGeneratorTarget.cxx | 11 ++-- Source/cmGetCMakePropertyCommand.cxx | 3 +- Source/cmGetDirectoryPropertyCommand.cxx | 2 +- Source/cmGetPropertyCommand.cxx | 3 +- Source/cmIncludeCommand.cxx | 3 +- Source/cmInstallCommand.cxx | 32 +++++----- Source/cmInstallFilesCommand.cxx | 5 +- Source/cmInstallProgramsCommand.cxx | 5 +- Source/cmInstallTargetGenerator.cxx | 6 +- Source/cmInstallTargetsCommand.cxx | 5 +- Source/cmMakefile.cxx | 63 ++++++++----------- Source/cmQtAutoGenerators.cxx | 7 +-- Source/cmSetPropertyCommand.cxx | 3 +- Source/cmSourceFile.cxx | 2 +- Source/cmSourceFileLocation.cxx | 3 +- Source/cmTarget.cxx | 18 +++--- 25 files changed, 86 insertions(+), 122 deletions(-) diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index cdca792b6..988e9a781 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -105,9 +105,8 @@ bool cmBuildCommand "Ignoring PROJECT_NAME option because it has no effect."); } - std::string makecommand = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GenerateCMakeBuildCommand(target, configuration, - "", true); + std::string makecommand = this->Makefile->GetGlobalGenerator() + ->GenerateCMakeBuildCommand(target, configuration, "", true); this->Makefile->AddDefinition(variable, makecommand.c_str()); @@ -135,9 +134,8 @@ bool cmBuildCommand configType = cfg; } - std::string makecommand = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType, - "", true); + std::string makecommand = this->Makefile->GetGlobalGenerator() + ->GenerateCMakeBuildCommand("", configType, "", true); if(cacheValue) { diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6ecf0dc57..1d884804d 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -247,7 +247,7 @@ cmComputeLinkInformation this->Target = target; this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); - this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); + this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); // Check whether to recognize OpenBSD-style library versioned names. diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index b1203dd01..bf18deb94 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -274,7 +274,7 @@ cmExportBuildFileGenerator ::FindNamespaces(cmMakefile* mf, const std::string& name) { std::vector namespaces; - cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator* gg = mf->GetGlobalGenerator(); std::map& exportSets = gg->GetBuildExportSets(); diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 06541c001..43d26f9e4 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -119,8 +119,7 @@ bool cmExportCommand std::vector targets; - cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator(); + cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator(); if(args[0] == "EXPORT") { diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 6d639c9ac..89c6ca297 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -479,7 +479,7 @@ cmExportInstallFileGenerator ::FindNamespaces(cmMakefile* mf, const std::string& name) { std::vector namespaces; - cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator* gg = mf->GetGlobalGenerator(); const cmExportSetMap& exportSets = gg->GetExportSets(); for(cmExportSetMap::const_iterator expIt = exportSets.begin(); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 14f397ce4..12da1fbd9 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3568,8 +3568,7 @@ void cmFileCommand::AddEvaluationFile(const std::string &inputName, cmsys::auto_ptr conditionCge = conditionGe.Parse(condition); - this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->AddEvaluationFile(inputName, + this->Makefile->GetGlobalGenerator()->AddEvaluationFile(inputName, outputCge, this->Makefile, conditionCge, @@ -3772,8 +3771,8 @@ bool cmFileCommand::HandleLockCommand( fclose(file); // Actual lock/unlock - cmFileLockPool& lockPool = this->Makefile->GetLocalGenerator()-> - GetGlobalGenerator()->GetFileLockPool(); + cmFileLockPool& lockPool = this->Makefile->GetGlobalGenerator() + ->GetFileLockPool(); cmFileLockResult fileLockResult(cmFileLockResult::MakeOk()); if (release) diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 507d011a7..0a66732b3 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -212,7 +212,7 @@ struct cmFindLibraryHelper cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf): Makefile(mf) { - this->GG = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + this->GG = this->Makefile->GetGlobalGenerator(); // Collect the list of library name prefixes/suffixes to try. const char* prefixes_list = diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index fa00283c2..c7269954b 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -103,8 +103,7 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile( std::string const& config) { std::vector enabledLanguages; - cmGlobalGenerator *gg - = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator(); gg->GetEnabledLanguages(enabledLanguages); for(std::vector::const_iterator le = enabledLanguages.begin(); @@ -168,8 +167,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() } std::vector enabledLanguages; - cmGlobalGenerator *gg - = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator(); gg->GetEnabledLanguages(enabledLanguages); for(std::vector::const_iterator le = enabledLanguages.begin(); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 265485176..6c41c3b44 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -768,8 +768,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode } std::vector enabledLanguages; - cmGlobalGenerator* gg - = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator* gg = context->Makefile->GetGlobalGenerator(); gg->GetEnabledLanguages(enabledLanguages); if (!parameters.empty() && std::find(enabledLanguages.begin(), enabledLanguages.end(), diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1a4f9c4e9..e2b8c459a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -132,8 +132,7 @@ struct TagVisitor TagVisitor(cmTarget *target, DataType& data) : Data(data), Target(target), - GlobalGenerator(target->GetMakefile() - ->GetLocalGenerator()->GetGlobalGenerator()), + GlobalGenerator(target->GetMakefile()->GetGlobalGenerator()), Header(CM_HEADER_REGEX), IsObjLib(target->GetType() == cmTarget::OBJECT_LIBRARY) { @@ -226,7 +225,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t), { this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); - this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); + this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); } //---------------------------------------------------------------------------- @@ -648,8 +647,7 @@ cmTargetTraceDependencies { // Convenience. this->Makefile = this->Target->GetMakefile(); - this->GlobalGenerator = - this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->CurrentEntry = 0; // Queue all the source files already specified for the target. @@ -1025,8 +1023,7 @@ void cmGeneratorTarget::GenerateTargetManifest( return; } cmMakefile* mf = this->Target->GetMakefile(); - cmLocalGenerator* lg = mf->GetLocalGenerator(); - cmGlobalGenerator* gg = lg->GetGlobalGenerator(); + cmGlobalGenerator* gg = mf->GetGlobalGenerator(); // Get the names. std::string name; diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index b0357505b..76803c103 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -47,8 +47,7 @@ bool cmGetCMakePropertyCommand else if ( args[1] == "COMPONENTS" ) { const std::set* components - = this->Makefile->GetLocalGenerator()->GetGlobalGenerator() - ->GetInstallComponents(); + = this->Makefile->GetGlobalGenerator()->GetInstallComponents(); output = cmJoin(*components, ";"); } else diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 881b2ae6b..4fe33189e 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -53,7 +53,7 @@ bool cmGetDirectoryPropertyCommand // lookup the makefile from the directory name cmLocalGenerator *lg = - this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + this->Makefile->GetGlobalGenerator()-> FindLocalGenerator(sd); if (!lg) { diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 00dbdd3e2..250bd3551 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -265,8 +265,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() // Lookup the generator. if(cmLocalGenerator* lg = - (this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->FindLocalGenerator(dir))) + (this->Makefile->GetGlobalGenerator()->FindLocalGenerator(dir))) { // Use the makefile for the directory found. mf = lg->GetMakefile(); diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 71dabaff4..372af63e6 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -93,8 +93,7 @@ bool cmIncludeCommand cmSystemTools::CollapseFullPath(fname, this->Makefile->GetCurrentSourceDirectory()); - cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator(); + cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator(); if (gg->IsExportedTargetsFile(fname_abs)) { const char *modal = 0; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index fac964141..aba00bd8f 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -62,8 +62,7 @@ bool cmInstallCommand::InitialPass(std::vector const& args, } // Enable the install target. - this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->EnableInstallTarget(); + this->Makefile->GetGlobalGenerator()->EnableInstallTarget(); this->DefaultComponentName = this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); @@ -198,7 +197,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector const& args) } //Tell the global generator about any installation component names specified. - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(component.c_str()); return true; @@ -774,7 +773,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) te->HeaderGenerator = publicHeaderGenerator; te->LibraryGenerator = libraryGenerator; te->RuntimeGenerator = runtimeGenerator; - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->GetExportSets()[exports.GetString()]->AddTargetExport(te); te->InterfaceIncludeDirectories = @@ -786,43 +785,42 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) // specified if (installsArchive) { - this->Makefile->GetLocalGenerator()-> - GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(archiveArgs.GetComponent().c_str()); } if (installsLibrary) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(libraryArgs.GetComponent().c_str()); } if (installsRuntime) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(runtimeArgs.GetComponent().c_str()); } if (installsFramework) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(frameworkArgs.GetComponent().c_str()); } if (installsBundle) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(bundleArgs.GetComponent().c_str()); } if (installsPrivateHeader) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(privateHeaderArgs.GetComponent().c_str()); } if (installsPublicHeader) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(publicHeaderArgs.GetComponent().c_str()); } if (installsResource) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(resourceArgs.GetComponent().c_str()); } @@ -890,7 +888,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) CreateInstallFilesGenerator(this->Makefile, absFiles, ica, programs)); //Tell the global generator about any installation component names specified. - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(ica.GetComponent().c_str()); return true; @@ -1235,7 +1233,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) // Tell the global generator about any installation component names // specified. - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(component.c_str()); return true; @@ -1322,8 +1320,8 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) } } - cmExportSet *exportSet = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GetExportSets()[exp.GetString()]; + cmExportSet *exportSet = this->Makefile->GetGlobalGenerator() + ->GetExportSets()[exp.GetString()]; if (exportOld.IsEnabled()) { for(std::vector::const_iterator diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 1fe435ce3..508c373a9 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -24,8 +24,7 @@ bool cmInstallFilesCommand } // Enable the install target. - this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->EnableInstallTarget(); + this->Makefile->GetGlobalGenerator()->EnableInstallTarget(); this->Destination = args[0]; @@ -48,7 +47,7 @@ bool cmInstallFilesCommand args.begin() + 1, args.end()); } - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME")); diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index 4899b95e0..be8096c2e 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -22,14 +22,13 @@ bool cmInstallProgramsCommand } // Enable the install target. - this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->EnableInstallTarget(); + this->Makefile->GetGlobalGenerator()->EnableInstallTarget(); this->Destination = args[0]; this->FinalArgs.insert(this->FinalArgs.end(), args.begin() + 1, args.end()); - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME")); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 11125d32c..082a78c18 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -728,8 +728,7 @@ cmInstallTargetGenerator i != oldRuntimeDirs.end(); ++i) { std::string runpath = - mf->GetLocalGenerator()-> - GetGlobalGenerator()->ExpandCFGIntDir(*i, config); + mf->GetGlobalGenerator()->ExpandCFGIntDir(*i, config); if(runpaths.find(runpath) == runpaths.end()) { @@ -745,8 +744,7 @@ cmInstallTargetGenerator i != newRuntimeDirs.end(); ++i) { std::string runpath = - mf->GetLocalGenerator()-> - GetGlobalGenerator()->ExpandCFGIntDir(*i, config); + mf->GetGlobalGenerator()->ExpandCFGIntDir(*i, config); if(runpaths.find(runpath) == runpaths.end()) { diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx index b738844a1..7e7b8488b 100644 --- a/Source/cmInstallTargetsCommand.cxx +++ b/Source/cmInstallTargetsCommand.cxx @@ -22,8 +22,7 @@ bool cmInstallTargetsCommand } // Enable the install target. - this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->EnableInstallTarget(); + this->Makefile->GetGlobalGenerator()->EnableInstallTarget(); cmTargets &tgts = this->Makefile->GetTargets(); std::vector::const_iterator s = args.begin(); @@ -57,7 +56,7 @@ bool cmInstallTargetsCommand } } - this->Makefile->GetLocalGenerator()->GetGlobalGenerator() + this->Makefile->GetGlobalGenerator() ->AddInstallComponent(this->Makefile->GetSafeDefinition( "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME")); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 699c0ef64..b7b4f795e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1014,7 +1014,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, // Generate a rule file if the main dependency is not available. if(!file) { - cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->GetGlobalGenerator(); // Construct a rule file associated with the first output produced. std::string outName = gg->GenerateRuleFile(outputs[0]); @@ -1420,8 +1420,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) // VS6 IDE does not support definition values with spaces in // combination with '"', '$', or ';'. - if((this->LocalGenerator->GetGlobalGenerator()->GetName() == - "Visual Studio 6") && + if((this->GetGlobalGenerator()->GetName() == "Visual Studio 6") && (def.find(" ") != def.npos && def.find_first_of("\"$;") != def.npos)) { return false; @@ -1505,8 +1504,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, cmTargets::iterator i = this->Targets.find(target); if ( i != this->Targets.end()) { - cmTarget* tgt = - this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(lib); + cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib); if(tgt) { // if it is not a static or shared library then you can not link to it @@ -1698,10 +1696,9 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } // create a new local generator and set its parent - cmLocalGenerator *lg2 = - this->LocalGenerator->GetGlobalGenerator() + cmLocalGenerator *lg2 = this->GetGlobalGenerator() ->CreateLocalGenerator(this->LocalGenerator); - this->LocalGenerator->GetGlobalGenerator()->AddLocalGenerator(lg2); + this->GetGlobalGenerator()->AddLocalGenerator(lg2); // set the subdirs start dirs lg2->GetMakefile()->SetCurrentSourceDirectory(srcPath); @@ -2017,7 +2014,7 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name, void cmMakefile::AddAlias(const std::string& lname, cmTarget *tgt) { this->AliasTargets[lname] = tgt; - this->LocalGenerator->GetGlobalGenerator()->AddAlias(lname, tgt); + this->GetGlobalGenerator()->AddAlias(lname, tgt); } cmTarget* cmMakefile::AddLibrary(const std::string& lname, @@ -2074,7 +2071,7 @@ cmMakefile::AddNewTarget(cmTarget::TargetType type, const std::string& name) cmTarget& target = it->second; target.SetType(type, name); target.SetMakefile(this); - this->LocalGenerator->GetGlobalGenerator()->AddTarget(&it->second); + this->GetGlobalGenerator()->AddTarget(&it->second); return &it->second; } @@ -2218,7 +2215,7 @@ void cmMakefile::AddSourceGroup(const std::vector& name, } // build the whole source group path const char* fullname = sg->GetFullName(); - cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->GetGlobalGenerator(); if(strlen(fullname)) { std::string guidName = "SG_Filter_"; @@ -3175,7 +3172,7 @@ std::string cmMakefile::GetConfigurations(std::vector& configs, bool single) const { - if(this->LocalGenerator->GetGlobalGenerator()->IsMultiConfig()) + if(this->GetGlobalGenerator()->IsMultiConfig()) { if(const char* configTypes = this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) @@ -3546,10 +3543,8 @@ void cmMakefile::EnableLanguage(std::vector const & lang, bool optional) { this->AddDefinition("CMAKE_CFG_INTDIR", - this->LocalGenerator->GetGlobalGenerator() - ->GetCMakeCFGIntDir()); - this->LocalGenerator->GetGlobalGenerator()->EnableLanguage(lang, this, - optional); + this->GetGlobalGenerator()->GetCMakeCFGIntDir()); + this->GetGlobalGenerator()->EnableLanguage(lang, this, optional); } int cmMakefile::TryCompile(const std::string& srcdir, @@ -3579,7 +3574,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, cmake cm; cm.SetIsInTryCompile(true); cmGlobalGenerator *gg = cm.CreateGlobalGenerator - (this->LocalGenerator->GetGlobalGenerator()->GetName()); + (this->GetGlobalGenerator()->GetName()); if (!gg) { cmSystemTools::Error( @@ -3640,8 +3635,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, cm.SetCacheArgs(*cmakeArgs); } // to save time we pass the EnableLanguage info directly - gg->EnableLanguagesFromGenerator - (this->LocalGenerator->GetGlobalGenerator(), this); + gg->EnableLanguagesFromGenerator(this->GetGlobalGenerator(), this); if(this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) { cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", @@ -3673,13 +3667,12 @@ int cmMakefile::TryCompile(const std::string& srcdir, } // finally call the generator to actually build the resulting project - int ret = - this->LocalGenerator->GetGlobalGenerator()->TryCompile(srcdir,bindir, - projectName, - targetName, - fast, - output, - this); + int ret = this->GetGlobalGenerator()->TryCompile(srcdir,bindir, + projectName, + targetName, + fast, + output, + this); cmSystemTools::ChangeDirectory(cwd); this->Internal->IsSourceFileTryCompile = false; @@ -4402,16 +4395,14 @@ void cmMakefile::PushScope() this->PushLoopBlockBarrier(); #if defined(CMAKE_BUILD_WITH_CMAKE) - this->GetLocalGenerator()->GetGlobalGenerator()-> - GetFileLockPool().PushFunctionScope(); + this->GetGlobalGenerator()->GetFileLockPool().PushFunctionScope(); #endif } void cmMakefile::PopScope() { #if defined(CMAKE_BUILD_WITH_CMAKE) - this->GetLocalGenerator()->GetGlobalGenerator()-> - GetFileLockPool().PopFunctionScope(); + this->GetGlobalGenerator()->GetFileLockPool().PopFunctionScope(); #endif this->PopLoopBlockBarrier(); @@ -4474,7 +4465,7 @@ cmMakefile::AddImportedTarget(const std::string& name, this->ImportedTargets[name] = target.get(); if(global) { - this->LocalGenerator->GetGlobalGenerator()->AddTarget(target.get()); + this->GetGlobalGenerator()->AddTarget(target.get()); } // Transfer ownership to this cmMakefile object. @@ -4502,8 +4493,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, } // Look for a target built in this project. - return this->LocalGenerator->GetGlobalGenerator()->FindTarget(name, - excludeAliases); + return this->GetGlobalGenerator()->FindTarget(name, excludeAliases); } //---------------------------------------------------------------------------- @@ -4511,8 +4501,7 @@ bool cmMakefile::IsAlias(const std::string& name) const { if (this->AliasTargets.find(name) != this->AliasTargets.end()) return true; - return this->GetLocalGenerator()->GetGlobalGenerator()->IsAlias( - name); + return this->GetGlobalGenerator()->IsAlias(name); } //---------------------------------------------------------------------------- @@ -4521,7 +4510,7 @@ cmMakefile::FindGeneratorTargetToUse(const std::string& name) const { if (cmTarget *t = this->FindTargetToUse(name)) { - return this->LocalGenerator->GetGlobalGenerator()->GetGeneratorTarget(t); + return this->GetGlobalGenerator()->GetGeneratorTarget(t); } return 0; } @@ -4626,7 +4615,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, const std::string& binPath) const { // Make sure the binary directory is unique. - cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->GetGlobalGenerator(); if(gg->BinaryDirectoryIsNew(binPath)) { return true; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 91b2b277e..457de1185 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -396,7 +396,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) std::vector rcc_output; bool const isNinja = - makefile->GetLocalGenerator()->GetGlobalGenerator()->GetName() == "Ninja"; + makefile->GetGlobalGenerator()->GetName() == "Ninja"; if(isNinja #if defined(_WIN32) && !defined(__CYGWIN__) || usePRE_BUILD @@ -524,9 +524,8 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target, cmMakefile* makefile = target->GetMakefile(); cmLocalGenerator* localGen = makefile->GetLocalGenerator(); std::vector includeDirs; - cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator() - ->GetGlobalGenerator() - ->GetGeneratorTarget(target); + cmGeneratorTarget *gtgt = localGen->GetGlobalGenerator() + ->GetGeneratorTarget(target); // Get the include dirs for this target, without stripping the implicit // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667 localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false); diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 35262b67a..31e460f0a 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -207,8 +207,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode() // Lookup the generator. if(cmLocalGenerator* lg = - (this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->FindLocalGenerator(dir))) + this->Makefile->GetGlobalGenerator()->FindLocalGenerator(dir)) { // Use the makefile for the directory found. mf = lg->GetMakefile(); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index cdd04edfa..724ab3941 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -282,7 +282,7 @@ void cmSourceFile::CheckLanguage(std::string const& ext) { // Try to identify the source file language from the extension. cmMakefile const* mf = this->Location.GetMakefile(); - cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator* gg = mf->GetGlobalGenerator(); std::string l = gg->GetLanguageFromExtension(ext.c_str()); if(!l.empty()) { diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index a0eba5e5d..4a87cc2b3 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -120,8 +120,7 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name) if(!ext.empty()) { ext = ext.substr(1); } // The global generator checks extensions of enabled languages. - cmGlobalGenerator* gg = - this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); cmMakefile const* mf = this->Makefile; const std::vector& srcExts = mf->GetSourceExtensions(); const std::vector& hdrExts = mf->GetHeaderExtensions(); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f69e9aeaa..ff1fa8a7a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -511,7 +511,7 @@ void cmTarget::FinishConfigure() #if defined(_WIN32) && !defined(__CYGWIN__) // Do old-style link dependency analysis only for CM_USE_OLD_VS6. - if(this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->IsForVS6()) + if(this->Makefile->GetGlobalGenerator()->IsForVS6()) { this->AnalyzeLibDependenciesForVS6(*this->Makefile); } @@ -847,8 +847,7 @@ cmTarget::GetConfigCommonSourceFiles(std::vector& files) const std::ostringstream e; e << "Target \"" << this->Name << "\" has source files which vary by " "configuration. This is not supported by the \"" - << this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GetName() + << this->Makefile->GetGlobalGenerator()->GetName() << "\" generator.\n" "Config \"" << firstConfig << "\":\n" " " << firstConfigFiles << "\n" @@ -1188,7 +1187,7 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf, //---------------------------------------------------------------------------- bool cmTarget::NameResolvesToFramework(const std::string& libname) const { - return this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + return this->Makefile->GetGlobalGenerator()-> NameResolvesToFramework(libname); } @@ -3329,7 +3328,7 @@ public: cmTargetSelectLinker(cmTarget const* target): Preference(0), Target(target) { this->Makefile = this->Target->GetMakefile(); - this->GG = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + this->GG = this->Makefile->GetGlobalGenerator(); } void Consider(const std::string& lang) { @@ -3764,7 +3763,7 @@ bool cmTarget::MacOSXRpathInstallNameDirDefault() const if(cmp0042 == cmPolicies::WARN) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + this->Makefile->GetGlobalGenerator()-> AddCMP0042WarnTarget(this->GetName()); } @@ -4551,7 +4550,7 @@ bool cmTarget::ComputeOutputDir(const std::string& config, "CMAKE_XCODE_EFFECTIVE_PLATFORMS"); std::string suffix = usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : ""; - this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + this->Makefile->GetGlobalGenerator()-> AppendDirectoryForConfig("/", conf, suffix, out); } @@ -4613,7 +4612,7 @@ bool cmTarget::ComputePDBOutputDir(const std::string& kind, // The generator may add the configuration's subdirectory. if(!conf.empty()) { - this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + this->Makefile->GetGlobalGenerator()-> AppendDirectoryForConfig("/", conf, "", out); } return true; @@ -5276,8 +5275,7 @@ void cmTarget::GetLanguages(std::set& languages, } else { - cmGeneratorTarget* gt = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator() + cmGeneratorTarget* gt = this->Makefile->GetGlobalGenerator() ->GetGeneratorTarget(this); gt->GetExternalObjects(externalObjects, config); for(std::vector::const_iterator