summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-30 11:27:43 +0000
committerKitware Robot <kwrobot@kitware.com>2021-06-30 07:27:49 -0400
commit85fe60ef032cd38a67f8b7dbedbb050590e4404f (patch)
tree2234d1c07201d45db9419b2f9fa8ad204109d096 /Source
parent123b9e18f3d3de20864281264995744426d9d7b7 (diff)
parente27a76f1311ab4ad1be07df018ac748d4b725cea (diff)
downloadcmake-85fe60ef032cd38a67f8b7dbedbb050590e4404f.tar.gz
Merge topic 'tll-out-of-dir'
e27a76f131 target_link_libraries: Restore transitive out-of-dir linking Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6285
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx14
-rw-r--r--Source/cmGeneratorTarget.h7
2 files changed, 14 insertions, 7 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f1c695fdc1..f035bd01fd 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -6349,11 +6349,11 @@ bool cmGeneratorTarget::IsLinkLookupScope(std::string const& n,
}
cm::optional<cmLinkItem> cmGeneratorTarget::LookupLinkItem(
- std::string const& n, cmListFileBacktrace const& bt) const
+ std::string const& n, cmListFileBacktrace const& bt,
+ LookupLinkItemScope* scope) const
{
cm::optional<cmLinkItem> maybeItem;
- cmLocalGenerator const* lg = this->LocalGenerator;
- if (this->IsLinkLookupScope(n, lg)) {
+ if (this->IsLinkLookupScope(n, scope->LG)) {
return maybeItem;
}
@@ -6361,7 +6361,7 @@ cm::optional<cmLinkItem> cmGeneratorTarget::LookupLinkItem(
if (name == this->GetName() || name.empty()) {
return maybeItem;
}
- maybeItem = this->ResolveLinkItem(name, bt, lg);
+ maybeItem = this->ResolveLinkItem(name, bt, scope->LG);
return maybeItem;
}
@@ -6388,9 +6388,10 @@ void cmGeneratorTarget::ExpandLinkItems(
&dagChecker, this, headTarget->LinkerLanguage),
libs);
cmMakefile const* mf = this->LocalGenerator->GetMakefile();
+ LookupLinkItemScope scope{ this->LocalGenerator };
for (std::string const& lib : libs) {
if (cm::optional<cmLinkItem> maybeItem =
- this->LookupLinkItem(lib, cge->GetBacktrace())) {
+ this->LookupLinkItem(lib, cge->GetBacktrace(), &scope)) {
if (!maybeItem->Target) {
// Report explicitly linked object files separately.
std::string const& maybeObj = maybeItem->AsStr();
@@ -7092,9 +7093,10 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
iface.HadContextSensitiveCondition,
iface.HadLinkLanguageSensitiveCondition);
std::vector<std::string> deps = cmExpandedList(info->SharedDeps);
+ LookupLinkItemScope scope{ this->LocalGenerator };
for (std::string const& dep : deps) {
if (cm::optional<cmLinkItem> maybeItem =
- this->LookupLinkItem(dep, cmListFileBacktrace())) {
+ this->LookupLinkItem(dep, cmListFileBacktrace(), &scope)) {
iface.SharedDeps.emplace_back(std::move(*maybeItem));
}
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 0619279cfc..e1909a4dce 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -1043,8 +1043,13 @@ private:
bool& hadHeadSensitiveCondition,
bool& hadContextSensitiveCondition,
bool& hadLinkLanguageSensitiveCondition) const;
+ struct LookupLinkItemScope
+ {
+ cmLocalGenerator const* LG;
+ };
cm::optional<cmLinkItem> LookupLinkItem(std::string const& n,
- cmListFileBacktrace const& bt) const;
+ cmListFileBacktrace const& bt,
+ LookupLinkItemScope* scope) const;
std::vector<BT<std::string>> GetSourceFilePaths(
std::string const& config) const;