|
|
@@ -847,7 +847,7 @@ static void AddInterfaceEntries(
|
|
|
std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries)
|
|
|
{
|
|
|
if(cmLinkImplementationLibraries const* impl =
|
|
|
- thisTarget->Target->GetLinkImplementationLibraries(config))
|
|
|
+ thisTarget->GetLinkImplementationLibraries(config))
|
|
|
{
|
|
|
for (std::vector<cmLinkImplItem>::const_iterator
|
|
|
it = impl->Libraries.begin(), end = impl->Libraries.end();
|
|
|
@@ -1901,7 +1901,7 @@ cmGeneratorTarget::GetLinkImplementationClosure(
|
|
|
std::set<cmTarget const*> emitted;
|
|
|
|
|
|
cmLinkImplementationLibraries const* impl
|
|
|
- = this->Target->GetLinkImplementationLibraries(config);
|
|
|
+ = this->GetLinkImplementationLibraries(config);
|
|
|
|
|
|
for(std::vector<cmLinkImplItem>::const_iterator
|
|
|
it = impl->Libraries.begin();
|
|
|
@@ -2501,7 +2501,7 @@ cmGeneratorTarget::GetIncludeDirectories(const std::string& config,
|
|
|
if(this->Makefile->IsOn("APPLE"))
|
|
|
{
|
|
|
cmLinkImplementationLibraries const* impl =
|
|
|
- this->Target->GetLinkImplementationLibraries(config);
|
|
|
+ this->GetLinkImplementationLibraries(config);
|
|
|
for(std::vector<cmLinkImplItem>::const_iterator
|
|
|
it = impl->Libraries.begin();
|
|
|
it != impl->Libraries.end(); ++it)
|
|
|
@@ -4363,8 +4363,7 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config,
|
|
|
{
|
|
|
// The link implementation is the default link interface.
|
|
|
cmLinkImplementationLibraries const*
|
|
|
- impl = this->Target->GetLinkImplementationLibrariesInternal(config,
|
|
|
- headTarget);
|
|
|
+ impl = this->GetLinkImplementationLibrariesInternal(config, headTarget);
|
|
|
iface.ImplementationIsInterface = true;
|
|
|
iface.WrongConfigLibraries = impl->WrongConfigLibraries;
|
|
|
}
|
|
|
@@ -4558,8 +4557,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
|
|
|
{
|
|
|
// The link implementation is the default link interface.
|
|
|
cmLinkImplementationLibraries const* impl =
|
|
|
- this->Target->GetLinkImplementationLibrariesInternal(config,
|
|
|
- headTarget);
|
|
|
+ this->GetLinkImplementationLibrariesInternal(config, headTarget);
|
|
|
iface.Libraries.insert(iface.Libraries.end(),
|
|
|
impl->Libraries.begin(), impl->Libraries.end());
|
|
|
if(this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
|
|
|
@@ -4674,12 +4672,12 @@ cmGeneratorTarget::GetLinkImplementation(const std::string& config) const
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- cmOptionalLinkImplementation& impl = this->Target->GetLinkImplMap(config);
|
|
|
+ std::string CONFIG = cmSystemTools::UpperCase(config);
|
|
|
+ cmOptionalLinkImplementation& impl = this->LinkImplMap[CONFIG][this->Target];
|
|
|
if(!impl.LibrariesDone)
|
|
|
{
|
|
|
impl.LibrariesDone = true;
|
|
|
- this->Target->ComputeLinkImplementationLibraries(config, impl,
|
|
|
- this->Target);
|
|
|
+ this->ComputeLinkImplementationLibraries(config, impl, this->Target);
|
|
|
}
|
|
|
if(!impl.LanguagesDone)
|
|
|
{
|
|
|
@@ -4819,9 +4817,161 @@ bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const
|
|
|
return false;
|
|
|
}
|
|
|
if(cmLinkImplementationLibraries const* impl =
|
|
|
- this->Target->GetLinkImplementationLibraries(config))
|
|
|
+ this->GetLinkImplementationLibraries(config))
|
|
|
{
|
|
|
return !impl->Libraries.empty();
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+//----------------------------------------------------------------------------
|
|
|
+cmLinkImplementationLibraries const*
|
|
|
+cmGeneratorTarget::GetLinkImplementationLibraries(
|
|
|
+ const std::string& config) const
|
|
|
+{
|
|
|
+ return this->GetLinkImplementationLibrariesInternal(config, this->Target);
|
|
|
+}
|
|
|
+
|
|
|
+//----------------------------------------------------------------------------
|
|
|
+cmLinkImplementationLibraries const*
|
|
|
+cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
|
|
|
+ const std::string& config, cmTarget const* head) const
|
|
|
+{
|
|
|
+ // There is no link implementation for imported targets.
|
|
|
+ if(this->IsImported())
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Populate the link implementation libraries for this configuration.
|
|
|
+ std::string CONFIG = cmSystemTools::UpperCase(config);
|
|
|
+ HeadToLinkImplementationMap& hm =
|
|
|
+ this->LinkImplMap[CONFIG];
|
|
|
+
|
|
|
+ // If the link implementation 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ cmOptionalLinkImplementation& impl = hm[head];
|
|
|
+ if(!impl.LibrariesDone)
|
|
|
+ {
|
|
|
+ impl.LibrariesDone = true;
|
|
|
+ this->ComputeLinkImplementationLibraries(config, impl, head);
|
|
|
+ }
|
|
|
+ return &impl;
|
|
|
+}
|
|
|
+
|
|
|
+//----------------------------------------------------------------------------
|
|
|
+void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
|
|
+ const std::string& config,
|
|
|
+ cmOptionalLinkImplementation& impl,
|
|
|
+ cmTarget const* head) const
|
|
|
+{
|
|
|
+ cmStringRange entryRange =
|
|
|
+ this->Target->GetLinkImplementationEntries();
|
|
|
+ cmBacktraceRange btRange =
|
|
|
+ this->Target->GetLinkImplementationBacktraces();
|
|
|
+ cmBacktraceRange::const_iterator btIt = btRange.begin();
|
|
|
+ // Collect libraries directly linked in this configuration.
|
|
|
+ for (cmStringRange::const_iterator le = entryRange.begin(),
|
|
|
+ end = entryRange.end(); le != end; ++le, ++btIt)
|
|
|
+ {
|
|
|
+ std::vector<std::string> llibs;
|
|
|
+ cmGeneratorExpressionDAGChecker dagChecker(
|
|
|
+ this->GetName(),
|
|
|
+ "LINK_LIBRARIES", 0, 0);
|
|
|
+ cmGeneratorExpression ge(*btIt);
|
|
|
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge =
|
|
|
+ ge.Parse(*le);
|
|
|
+ std::string const evaluated =
|
|
|
+ cge->Evaluate(this->Makefile, config, false, head, &dagChecker);
|
|
|
+ cmSystemTools::ExpandListArgument(evaluated, llibs);
|
|
|
+ if(cge->GetHadHeadSensitiveCondition())
|
|
|
+ {
|
|
|
+ impl.HadHeadSensitiveCondition = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ for(std::vector<std::string>::const_iterator li = llibs.begin();
|
|
|
+ li != llibs.end(); ++li)
|
|
|
+ {
|
|
|
+ // Skip entries that resolve to the target itself or are empty.
|
|
|
+ std::string name = this->Target->CheckCMP0004(*li);
|
|
|
+ if(name == this->GetName() || name.empty())
|
|
|
+ {
|
|
|
+ if(name == this->GetName())
|
|
|
+ {
|
|
|
+ bool noMessage = false;
|
|
|
+ cmake::MessageType messageType = cmake::FATAL_ERROR;
|
|
|
+ std::ostringstream e;
|
|
|
+ switch(this->Target->GetPolicyStatusCMP0038())
|
|
|
+ {
|
|
|
+ case cmPolicies::WARN:
|
|
|
+ {
|
|
|
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0038) << "\n";
|
|
|
+ messageType = cmake::AUTHOR_WARNING;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case cmPolicies::OLD:
|
|
|
+ noMessage = true;
|
|
|
+ case cmPolicies::REQUIRED_IF_USED:
|
|
|
+ case cmPolicies::REQUIRED_ALWAYS:
|
|
|
+ case cmPolicies::NEW:
|
|
|
+ // Issue the fatal message.
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!noMessage)
|
|
|
+ {
|
|
|
+ e << "Target \"" << this->GetName() << "\" links to itself.";
|
|
|
+ this->LocalGenerator->GetCMakeInstance()->IssueMessage(
|
|
|
+ messageType, e.str(), this->Target->GetBacktrace());
|
|
|
+ if (messageType == cmake::FATAL_ERROR)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ // The entry is meant for this configuration.
|
|
|
+ impl.Libraries.push_back(
|
|
|
+ cmLinkImplItem(name, this->Target->FindTargetToLink(name),
|
|
|
+ *btIt, evaluated != *le));
|
|
|
+ }
|
|
|
+
|
|
|
+ std::set<std::string> const& seenProps = cge->GetSeenTargetProperties();
|
|
|
+ for (std::set<std::string>::const_iterator it = seenProps.begin();
|
|
|
+ it != seenProps.end(); ++it)
|
|
|
+ {
|
|
|
+ if (!this->GetProperty(*it))
|
|
|
+ {
|
|
|
+ this->Target->LinkImplicitNullProperties.insert(*it);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cge->GetMaxLanguageStandard(this->Target,
|
|
|
+ this->MaxLanguageStandards);
|
|
|
+ }
|
|
|
+
|
|
|
+ cmTarget::LinkLibraryType linkType = this->Target->ComputeLinkType(config);
|
|
|
+ cmTarget::LinkLibraryVectorType const& oldllibs =
|
|
|
+ this->Target->GetOriginalLinkLibraries();
|
|
|
+ for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
|
|
|
+ li != oldllibs.end(); ++li)
|
|
|
+ {
|
|
|
+ if(li->second != cmTarget::GENERAL && li->second != linkType)
|
|
|
+ {
|
|
|
+ std::string name = this->Target->CheckCMP0004(li->first);
|
|
|
+ if(name == this->GetName() || name.empty())
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // Support OLD behavior for CMP0003.
|
|
|
+ impl.WrongConfigLibraries.push_back(
|
|
|
+ cmLinkItem(name, this->Target->FindTargetToLink(name)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|