cmComputeLinkDepends: Port to cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-08-04 19:19:50 +02:00
parent c93230ac38
commit 4329a71c12
3 changed files with 14 additions and 11 deletions

View File

@ -173,18 +173,19 @@ items that we know the linker will re-use automatically (shared libs).
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmComputeLinkDepends cmComputeLinkDepends
::cmComputeLinkDepends(cmTarget const* target, const std::string& config) ::cmComputeLinkDepends(const cmGeneratorTarget* target,
const std::string& config)
{ {
// Store context information. // Store context information.
this->Target = target; this->Target = target;
this->Makefile = this->Target->GetMakefile(); this->Makefile = this->Target->Target->GetMakefile();
this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->GlobalGenerator = this->Makefile->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
// The configuration being linked. // The configuration being linked.
this->HasConfig = !config.empty(); this->HasConfig = !config.empty();
this->Config = (this->HasConfig)? config : std::string(); this->Config = (this->HasConfig)? config : std::string();
this->LinkType = this->Target->ComputeLinkType(this->Config); this->LinkType = this->Target->Target->ComputeLinkType(this->Config);
// Enable debug mode if requested. // Enable debug mode if requested.
this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE"); this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE");
@ -363,7 +364,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
{ {
// Follow the target dependencies. // Follow the target dependencies.
if(cmTarget::LinkInterface const* iface = if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target)) entry.Target->GetLinkInterface(this->Config, this->Target->Target))
{ {
const bool isIface = const bool isIface =
entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY; entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY;
@ -461,7 +462,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
if(entry.Target) if(entry.Target)
{ {
if(cmTarget::LinkInterface const* iface = if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target)) entry.Target->GetLinkInterface(this->Config, this->Target->Target))
{ {
// Follow public and private dependencies transitively. // Follow public and private dependencies transitively.
this->FollowSharedDeps(index, iface, true); this->FollowSharedDeps(index, iface, true);
@ -552,7 +553,7 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
{ {
// Add direct link dependencies in this configuration. // Add direct link dependencies in this configuration.
cmTarget::LinkImplementation const* impl = cmTarget::LinkImplementation const* impl =
this->Target->GetLinkImplementation(this->Config); this->Target->Target->GetLinkImplementation(this->Config);
this->AddLinkEntries(-1, impl->Libraries); this->AddLinkEntries(-1, impl->Libraries);
for(std::vector<cmLinkItem>::const_iterator for(std::vector<cmLinkItem>::const_iterator
wi = impl->WrongConfigLibraries.begin(); wi = impl->WrongConfigLibraries.begin();
@ -634,7 +635,7 @@ cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index,
const std::string& name) const std::string& name)
{ {
// Look for a target in the scope of the depender. // Look for a target in the scope of the depender.
cmTarget const* from = this->Target; cmTarget const* from = this->Target->Target;
if(depender_index >= 0) if(depender_index >= 0)
{ {
if(cmTarget const* depender = this->EntryList[depender_index].Target) if(cmTarget const* depender = this->EntryList[depender_index].Target)
@ -932,7 +933,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
if(cmTarget const* target = this->EntryList[*ni].Target) if(cmTarget const* target = this->EntryList[*ni].Target)
{ {
if(cmTarget::LinkInterface const* iface = if(cmTarget::LinkInterface const* iface =
target->GetLinkInterface(this->Config, this->Target)) target->GetLinkInterface(this->Config, this->Target->Target))
{ {
if(iface->Multiplicity > count) if(iface->Multiplicity > count)
{ {

View File

@ -22,6 +22,7 @@
class cmComputeComponentGraph; class cmComputeComponentGraph;
class cmGlobalGenerator; class cmGlobalGenerator;
class cmMakefile; class cmMakefile;
class cmGeneratorTarget;
class cmTarget; class cmTarget;
class cmake; class cmake;
@ -31,7 +32,8 @@ class cmake;
class cmComputeLinkDepends class cmComputeLinkDepends
{ {
public: public:
cmComputeLinkDepends(cmTarget const* target, const std::string& config); cmComputeLinkDepends(cmGeneratorTarget const* target,
const std::string& config);
~cmComputeLinkDepends(); ~cmComputeLinkDepends();
// Basic information about each link item. // Basic information about each link item.
@ -57,7 +59,7 @@ public:
private: private:
// Context information. // Context information.
cmTarget const* Target; cmGeneratorTarget const* Target;
cmMakefile* Makefile; cmMakefile* Makefile;
cmGlobalGenerator const* GlobalGenerator; cmGlobalGenerator const* GlobalGenerator;
cmake* CMakeInstance; cmake* CMakeInstance;

View File

@ -497,7 +497,7 @@ bool cmComputeLinkInformation::Compute()
} }
// Compute the ordered link line items. // Compute the ordered link line items.
cmComputeLinkDepends cld(this->Target->Target, this->Config); cmComputeLinkDepends cld(this->Target, this->Config);
cld.SetOldLinkDirMode(this->OldLinkDirMode); cld.SetOldLinkDirMode(this->OldLinkDirMode);
cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute(); cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();