Commit d4a24c0e authored by Stephen Kelly's avatar Stephen Kelly
Browse files

cmGeneratorTarget: Move GetLinkImplementation from cmTarget.

parent 83981cf5
......@@ -555,7 +555,7 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
{
// Add direct link dependencies in this configuration.
cmLinkImplementation const* impl =
this->Target->Target->GetLinkImplementation(this->Config);
this->Target->GetLinkImplementation(this->Config);
this->AddLinkEntries(-1, impl->Libraries);
for(std::vector<cmLinkItem>::const_iterator
wi = impl->WrongConfigLibraries.begin();
......
......@@ -252,8 +252,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
}
}
cmLinkImplementation const* impl =
depender->Target->GetLinkImplementation(*it);
cmLinkImplementation const* impl = depender->GetLinkImplementation(*it);
// A target should not depend on itself.
emitted.insert(depender->GetName());
......
......@@ -1336,7 +1336,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
// Get languages built in this target.
UNORDERED_SET<std::string> languages;
cmLinkImplementation const* impl =
this->Target->GetLinkImplementation(config);
this->GetLinkImplementation(config);
assert(impl);
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
li != impl->Languages.end(); ++li)
......@@ -4058,7 +4058,7 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config,
if (this->GetType() != cmTarget::INTERFACE_LIBRARY)
{
cmLinkImplementation const* impl =
this->Target->GetLinkImplementation(config);
this->GetLinkImplementation(config);
for(std::vector<cmLinkImplItem>::const_iterator
li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
{
......@@ -4099,7 +4099,7 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config,
{
// Targets using this archive need its language runtime libraries.
if(cmLinkImplementation const* impl =
this->Target->GetLinkImplementation(config))
this->GetLinkImplementation(config))
{
iface.Languages = impl->Languages;
}
......@@ -4389,3 +4389,28 @@ cmGeneratorTarget::GetHeadToLinkInterfaceUsageRequirementsMap(
std::string CONFIG = cmSystemTools::UpperCase(config);
return this->LinkInterfaceUsageRequirementsOnlyMap[CONFIG];
}
//----------------------------------------------------------------------------
const cmLinkImplementation *
cmGeneratorTarget::GetLinkImplementation(const std::string& config) const
{
// There is no link implementation for imported targets.
if(this->Target->IsImported())
{
return 0;
}
cmOptionalLinkImplementation& impl = this->Target->GetLinkImplMap(config);
if(!impl.LibrariesDone)
{
impl.LibrariesDone = true;
this->Target->ComputeLinkImplementationLibraries(config, impl,
this->Target);
}
if(!impl.LanguagesDone)
{
impl.LanguagesDone = true;
this->Target->ComputeLinkImplementationLanguages(config, impl);
}
return &impl;
}
......@@ -198,6 +198,9 @@ public:
LinkClosure const* GetLinkClosure(const std::string& config) const;
void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
cmLinkImplementation const*
GetLinkImplementation(const std::string& config) const;
/** Full path with trailing slash to the top-level directory
holding object files for this target. Includes the build
time config name placeholder if needed for the generator. */
......
......@@ -1384,7 +1384,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
// If the language is compiled as a source trust Xcode to link with it.
cmLinkImplementation const* impl =
cmtarget.GetLinkImplementation("NOCONFIG");
gtgt->GetLinkImplementation("NOCONFIG");
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
li != impl->Languages.end(); ++li)
{
......
......@@ -3564,30 +3564,6 @@ void cmTargetInternals::AddInterfaceEntries(
}
}
//----------------------------------------------------------------------------
const cmLinkImplementation *
cmTarget::GetLinkImplementation(const std::string& config) const
{
// There is no link implementation for imported targets.
if(this->IsImported())
{
return 0;
}
cmOptionalLinkImplementation& impl = this->GetLinkImplMap(config);
if(!impl.LibrariesDone)
{
impl.LibrariesDone = true;
this->ComputeLinkImplementationLibraries(config, impl, this);
}
if(!impl.LanguagesDone)
{
impl.LanguagesDone = true;
this->ComputeLinkImplementationLanguages(config, impl);
}
return &impl;
}
cmOptionalLinkImplementation&
cmTarget::GetLinkImplMap(std::string const& config) const
{
......
......@@ -231,9 +231,6 @@ public:
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
cmLinkImplementation const*
GetLinkImplementation(const std::string& config) const;
cmLinkImplementationLibraries const*
GetLinkImplementationLibraries(const std::string& config) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment