cmComputeLinkInformation: Simplify generator object access.

This commit is contained in:
Stephen Kelly 2015-08-02 19:35:48 +02:00
parent 22590805bf
commit 27252b2414
1 changed files with 7 additions and 11 deletions

View File

@ -14,6 +14,7 @@
#include "cmComputeLinkDepends.h" #include "cmComputeLinkDepends.h"
#include "cmOrderDirectories.h" #include "cmOrderDirectories.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmState.h" #include "cmState.h"
#include "cmOutputConverter.h" #include "cmOutputConverter.h"
@ -248,7 +249,8 @@ cmComputeLinkInformation
// Store context information. // Store context information.
this->Target = target; this->Target = target;
this->Makefile = this->Target->Target->GetMakefile(); this->Makefile = this->Target->Target->GetMakefile();
this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->GlobalGenerator =
this->Target->GetLocalGenerator()->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
// Check whether to recognize OpenBSD-style library versioned names. // Check whether to recognize OpenBSD-style library versioned names.
@ -540,9 +542,7 @@ bool cmComputeLinkInformation::Compute()
i != wrongItems.end(); ++i) i != wrongItems.end(); ++i)
{ {
cmTarget const* tgt = *i; cmTarget const* tgt = *i;
cmGeneratorTarget *gtgt = tgt->GetMakefile() cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
->GetGlobalGenerator()
->GetGeneratorTarget(tgt);
bool implib = bool implib =
(this->UseImportLibrary && (this->UseImportLibrary &&
(tgt->GetType() == cmTarget::SHARED_LIBRARY)); (tgt->GetType() == cmTarget::SHARED_LIBRARY));
@ -646,9 +646,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
if(tgt && tgt->IsLinkable()) if(tgt && tgt->IsLinkable())
{ {
cmGeneratorTarget *gtgt = tgt->GetMakefile() cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
->GetGlobalGenerator()
->GetGeneratorTarget(tgt);
// This is a CMake target. Ask the target for its real name. // This is a CMake target. Ask the target for its real name.
if(impexe && this->LoaderFlag) if(impexe && this->LoaderFlag)
{ {
@ -762,7 +760,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
return; return;
} }
cmGeneratorTarget *gtgt = 0; cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
// Get a full path to the dependent shared library. // Get a full path to the dependent shared library.
// Add it to the runtime path computation so that the target being // Add it to the runtime path computation so that the target being
@ -1812,9 +1810,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
// Try to get the soname of the library. Only files with this name // Try to get the soname of the library. Only files with this name
// could possibly conflict. // could possibly conflict.
cmGeneratorTarget *gtgt = target->GetMakefile() cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(target);
->GetGlobalGenerator()
->GetGeneratorTarget(target);
std::string soName = gtgt->GetSOName(this->Config); std::string soName = gtgt->GetSOName(this->Config);
const char* soname = soName.empty()? 0 : soName.c_str(); const char* soname = soName.empty()? 0 : soName.c_str();