cmGeneratorTarget: Move GetLinkInterface from cmTarget.
This commit is contained in:
parent
6353816786
commit
6220241fd0
|
@ -360,9 +360,11 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
|
||||||
// Follow the item's dependencies.
|
// Follow the item's dependencies.
|
||||||
if(entry.Target)
|
if(entry.Target)
|
||||||
{
|
{
|
||||||
|
cmGeneratorTarget* gtgt =
|
||||||
|
this->GlobalGenerator->GetGeneratorTarget(entry.Target);
|
||||||
// Follow the target dependencies.
|
// Follow the target dependencies.
|
||||||
if(cmLinkInterface const* iface =
|
if(cmLinkInterface const* iface =
|
||||||
entry.Target->GetLinkInterface(this->Config, this->Target->Target))
|
gtgt->GetLinkInterface(this->Config, this->Target->Target))
|
||||||
{
|
{
|
||||||
const bool isIface =
|
const bool isIface =
|
||||||
entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY;
|
entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY;
|
||||||
|
@ -459,8 +461,10 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
|
||||||
// Target items may have their own dependencies.
|
// Target items may have their own dependencies.
|
||||||
if(entry.Target)
|
if(entry.Target)
|
||||||
{
|
{
|
||||||
|
cmGeneratorTarget* gtgt =
|
||||||
|
this->GlobalGenerator->GetGeneratorTarget(entry.Target);
|
||||||
if(cmLinkInterface const* iface =
|
if(cmLinkInterface const* iface =
|
||||||
entry.Target->GetLinkInterface(this->Config, this->Target->Target))
|
gtgt->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);
|
||||||
|
@ -930,8 +934,10 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
|
||||||
{
|
{
|
||||||
if(cmTarget const* target = this->EntryList[*ni].Target)
|
if(cmTarget const* target = this->EntryList[*ni].Target)
|
||||||
{
|
{
|
||||||
|
cmGeneratorTarget* gtgt =
|
||||||
|
this->GlobalGenerator->GetGeneratorTarget(target);
|
||||||
if(cmLinkInterface const* iface =
|
if(cmLinkInterface const* iface =
|
||||||
target->GetLinkInterface(this->Config, this->Target->Target))
|
gtgt->GetLinkInterface(this->Config, this->Target->Target))
|
||||||
{
|
{
|
||||||
if(iface->Multiplicity > count)
|
if(iface->Multiplicity > count)
|
||||||
{
|
{
|
||||||
|
|
|
@ -297,7 +297,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
|
||||||
{
|
{
|
||||||
cmGeneratorTarget const* depender = this->Targets[depender_index];
|
cmGeneratorTarget const* depender = this->Targets[depender_index];
|
||||||
if(cmLinkInterface const* iface =
|
if(cmLinkInterface const* iface =
|
||||||
dependee->Target->GetLinkInterface(config,
|
dependee->GetLinkInterface(config,
|
||||||
depender->Target))
|
depender->Target))
|
||||||
{
|
{
|
||||||
for(std::vector<cmLinkItem>::const_iterator
|
for(std::vector<cmLinkItem>::const_iterator
|
||||||
|
|
|
@ -796,9 +796,8 @@ cmExportFileGenerator
|
||||||
std::vector<std::string>& missingTargets)
|
std::vector<std::string>& missingTargets)
|
||||||
{
|
{
|
||||||
// Add the transitive link dependencies for this configuration.
|
// Add the transitive link dependencies for this configuration.
|
||||||
cmLinkInterface const* iface = target->Target->GetLinkInterface(
|
cmLinkInterface const* iface = target->GetLinkInterface(config,
|
||||||
config,
|
target->Target);
|
||||||
target->Target);
|
|
||||||
if (!iface)
|
if (!iface)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -910,8 +909,7 @@ cmExportFileGenerator
|
||||||
|
|
||||||
// Add the transitive link dependencies for this configuration.
|
// Add the transitive link dependencies for this configuration.
|
||||||
if(cmLinkInterface const* iface =
|
if(cmLinkInterface const* iface =
|
||||||
target->Target
|
target->GetLinkInterface(config, target->Target))
|
||||||
->GetLinkInterface(config, target->Target))
|
|
||||||
{
|
{
|
||||||
this->SetImportLinkProperty(suffix, target,
|
this->SetImportLinkProperty(suffix, target,
|
||||||
"IMPORTED_LINK_INTERFACE_LANGUAGES",
|
"IMPORTED_LINK_INTERFACE_LANGUAGES",
|
||||||
|
|
|
@ -1172,9 +1172,11 @@ public:
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
cmGeneratorTarget* gtgt =
|
||||||
|
this->Target->GetLocalGenerator()->GetGlobalGenerator()
|
||||||
|
->GetGeneratorTarget(item.Target);
|
||||||
cmLinkInterface const* iface =
|
cmLinkInterface const* iface =
|
||||||
item.Target->GetLinkInterface(this->Config, this->HeadTarget);
|
gtgt->GetLinkInterface(this->Config, this->HeadTarget);
|
||||||
if(!iface) { return; }
|
if(!iface) { return; }
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator
|
for(std::vector<std::string>::const_iterator
|
||||||
|
@ -3354,3 +3356,52 @@ cmGeneratorTarget::ReportPropertyOrigin(const std::string &p,
|
||||||
|
|
||||||
this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport);
|
this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
cmLinkInterface const*
|
||||||
|
cmGeneratorTarget::GetLinkInterface(const std::string& config,
|
||||||
|
cmTarget const* head) const
|
||||||
|
{
|
||||||
|
// Imported targets have their own link interface.
|
||||||
|
if(this->IsImported())
|
||||||
|
{
|
||||||
|
return this->Target->GetImportLinkInterface(config, head, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Link interfaces are not supported for executables that do not
|
||||||
|
// export symbols.
|
||||||
|
if(this->GetType() == cmTarget::EXECUTABLE &&
|
||||||
|
!this->Target->IsExecutableWithExports())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lookup any existing link interface for this configuration.
|
||||||
|
cmHeadToLinkInterfaceMap& hm =
|
||||||
|
this->Target->GetHeadToLinkInterfaceMap(config);
|
||||||
|
|
||||||
|
// If the link interface does not depend on the head target
|
||||||
|
// then return the one we computed first.
|
||||||
|
if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
|
||||||
|
{
|
||||||
|
return &hm.begin()->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmOptionalLinkInterface& iface = hm[head];
|
||||||
|
if(!iface.LibrariesDone)
|
||||||
|
{
|
||||||
|
iface.LibrariesDone = true;
|
||||||
|
this->Target->ComputeLinkInterfaceLibraries(
|
||||||
|
config, iface, head, false);
|
||||||
|
}
|
||||||
|
if(!iface.AllDone)
|
||||||
|
{
|
||||||
|
iface.AllDone = true;
|
||||||
|
if(iface.Exists)
|
||||||
|
{
|
||||||
|
this->Target->ComputeLinkInterface(config, iface, head);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return iface.Exists? &iface : 0;
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#ifndef cmGeneratorTarget_h
|
#ifndef cmGeneratorTarget_h
|
||||||
#define cmGeneratorTarget_h
|
#define cmGeneratorTarget_h
|
||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmLinkItem.h"
|
||||||
|
|
||||||
class cmCustomCommand;
|
class cmCustomCommand;
|
||||||
class cmGlobalGenerator;
|
class cmGlobalGenerator;
|
||||||
|
@ -106,6 +106,8 @@ public:
|
||||||
const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p,
|
const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p,
|
||||||
const std::string& config) const;
|
const std::string& config) const;
|
||||||
|
|
||||||
|
cmLinkInterface const* GetLinkInterface(const std::string& config,
|
||||||
|
cmTarget const* headTarget) const;
|
||||||
|
|
||||||
/** Get the full path to the target according to the settings in its
|
/** Get the full path to the target according to the settings in its
|
||||||
makefile and the configuration type. */
|
makefile and the configuration type. */
|
||||||
|
|
|
@ -4107,53 +4107,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
cmLinkInterface const* cmTarget::GetLinkInterface(const std::string& config,
|
|
||||||
cmTarget const* head) const
|
|
||||||
{
|
|
||||||
// Imported targets have their own link interface.
|
|
||||||
if(this->IsImported())
|
|
||||||
{
|
|
||||||
return this->GetImportLinkInterface(config, head, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Link interfaces are not supported for executables that do not
|
|
||||||
// export symbols.
|
|
||||||
if(this->GetType() == cmTarget::EXECUTABLE &&
|
|
||||||
!this->IsExecutableWithExports())
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup any existing link interface for this configuration.
|
|
||||||
cmHeadToLinkInterfaceMap& hm = this->GetHeadToLinkInterfaceMap(config);
|
|
||||||
|
|
||||||
// If the link interface does not depend on the head target
|
|
||||||
// then return the one we computed first.
|
|
||||||
if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
|
|
||||||
{
|
|
||||||
return &hm.begin()->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmOptionalLinkInterface& iface = hm[head];
|
|
||||||
if(!iface.LibrariesDone)
|
|
||||||
{
|
|
||||||
iface.LibrariesDone = true;
|
|
||||||
this->ComputeLinkInterfaceLibraries(
|
|
||||||
config, iface, head, false);
|
|
||||||
}
|
|
||||||
if(!iface.AllDone)
|
|
||||||
{
|
|
||||||
iface.AllDone = true;
|
|
||||||
if(iface.Exists)
|
|
||||||
{
|
|
||||||
this->ComputeLinkInterface(config, iface, head);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return iface.Exists? &iface : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const cmLinkInterfaceLibraries *
|
const cmLinkInterfaceLibraries *
|
||||||
cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
||||||
|
|
|
@ -241,10 +241,6 @@ public:
|
||||||
cmTarget const* head,
|
cmTarget const* head,
|
||||||
bool usage_requirements_only) const;
|
bool usage_requirements_only) const;
|
||||||
|
|
||||||
/** Get the link interface for the given configuration. Returns 0
|
|
||||||
if the target cannot be linked. */
|
|
||||||
cmLinkInterface const* GetLinkInterface(const std::string& config,
|
|
||||||
cmTarget const* headTarget) const;
|
|
||||||
cmLinkInterfaceLibraries const*
|
cmLinkInterfaceLibraries const*
|
||||||
GetLinkInterfaceLibraries(const std::string& config,
|
GetLinkInterfaceLibraries(const std::string& config,
|
||||||
cmTarget const* headTarget,
|
cmTarget const* headTarget,
|
||||||
|
|
Loading…
Reference in New Issue