diff options
author | Brad King <brad.king@kitware.com> | 2015-05-04 15:02:23 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-05-04 15:02:23 (GMT) |
commit | 0d167b3e609bf7addc51567f92c9cf5b0b898381 (patch) | |
tree | 398facbdb16336cf9a6e90e29deef5387b66fc24 /Source/cmMakefile.cxx | |
parent | 1ef88dcd46da72e489204141d66509f484738e1b (diff) | |
parent | a0836ed97804952ace98d2c1d0d46e968a532a3c (diff) | |
download | CMake-0d167b3e609bf7addc51567f92c9cf5b0b898381.zip CMake-0d167b3e609bf7addc51567f92c9cf5b0b898381.tar.gz CMake-0d167b3e609bf7addc51567f92c9cf5b0b898381.tar.bz2 |
Merge topic 'add-cmMakefile-GetGlobalGenerator'
a0836ed9 Port to cmMakefile::GetGlobalGenerator.
cbf143bb cmComputeTargetDepends: Use simpler global generator access.
040491fc cmComputeLinkDepends: Remove unused local generator.
0bb6dbe0 cmMakefile: Extract an accessor for the global generator.
e1bdf5f5 cmMakefile: Use GetCMakeInstance.
efcca935 cmMakefile: Simplify GetCMakeInstance implementation.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 80 |
1 files changed, 34 insertions, 46 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4ed2419..7b3ca53 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1010,7 +1010,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& 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]); @@ -1416,8 +1416,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; @@ -1501,8 +1500,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 @@ -1694,10 +1692,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); @@ -2013,7 +2010,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, @@ -2070,7 +2067,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; } @@ -2214,7 +2211,7 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& 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_"; @@ -3171,7 +3168,7 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs, bool single) const { - if(this->LocalGenerator->GetGlobalGenerator()->IsMultiConfig()) + if(this->GetGlobalGenerator()->IsMultiConfig()) { if(const char* configTypes = this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) @@ -3542,10 +3539,8 @@ void cmMakefile::EnableLanguage(std::vector<std::string> 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, @@ -3575,7 +3570,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( @@ -3636,8 +3631,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", @@ -3669,13 +3663,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; @@ -3689,11 +3682,12 @@ bool cmMakefile::GetIsSourceFileTryCompile() const cmake *cmMakefile::GetCMakeInstance() const { - if ( this->LocalGenerator && this->LocalGenerator->GetGlobalGenerator() ) - { - return this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance(); - } - return 0; + return this->GetGlobalGenerator()->GetCMakeInstance(); +} + +cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const +{ + return this->LocalGenerator->GetGlobalGenerator(); } #ifdef CMAKE_BUILD_WITH_CMAKE @@ -3727,8 +3721,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 @@ -4398,16 +4391,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(); @@ -4470,7 +4461,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. @@ -4498,8 +4489,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); } //---------------------------------------------------------------------------- @@ -4507,8 +4497,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); } //---------------------------------------------------------------------------- @@ -4517,7 +4506,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; } @@ -4570,8 +4559,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() @@ -4623,7 +4611,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; |