summaryrefslogtreecommitdiff
path: root/Source/cmComputeLinkDepends.cxx
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-09-02 14:53:41 -0400
committerZack Galbreath <zack.galbreath@kitware.com>2021-06-07 19:25:33 +0000
commit947dbed0aa502c70a9e165757450bd8409036980 (patch)
tree0a45b31986184368c7ad6df72d9f9186c7a24b4c /Source/cmComputeLinkDepends.cxx
parentb50bfc89131e55685aa41146254b37d26049b4d5 (diff)
downloadcmake-947dbed0aa502c70a9e165757450bd8409036980.tar.gz
HIP: Automatically inject the `hip::device` runtime target
Any target that might need to link to hip code needs the `hip::device` target
Diffstat (limited to 'Source/cmComputeLinkDepends.cxx')
-rw-r--r--Source/cmComputeLinkDepends.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 4a6518fde4..0b27e34c2b 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -7,6 +7,7 @@
#include <cstdio>
#include <iterator>
#include <sstream>
+#include <unordered_map>
#include <utility>
#include <cm/memory>
@@ -371,6 +372,12 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry qe)
// This target provides its own link interface information.
this->AddLinkEntries(depender_index, iface->Libraries);
this->AddLinkObjects(iface->Objects);
+ for (auto const& language : iface->Languages) {
+ auto runtimeEntries = iface->LanguageRuntimeLibraries.find(language);
+ if (runtimeEntries != iface->LanguageRuntimeLibraries.end()) {
+ this->AddLinkEntries(depender_index, runtimeEntries->second);
+ }
+ }
if (isIface) {
return;
@@ -516,6 +523,13 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
this->Target->GetLinkImplementation(this->Config);
this->AddLinkEntries(-1, impl->Libraries);
this->AddLinkObjects(impl->Objects);
+
+ for (auto const& language : impl->Languages) {
+ auto runtimeEntries = impl->LanguageRuntimeLibraries.find(language);
+ if (runtimeEntries != impl->LanguageRuntimeLibraries.end()) {
+ this->AddLinkEntries(-1, runtimeEntries->second);
+ }
+ }
for (cmLinkItem const& wi : impl->WrongConfigLibraries) {
this->CheckWrongConfigItem(wi);
}