summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2018-03-27 18:59:34 (GMT)
committerBrad King <brad.king@kitware.com>2018-03-28 13:38:43 (GMT)
commit41eab150a8ef42bbebff18ff84652e9da1ef4e75 (patch)
tree80799f497ace9a2151b7d900e4f71fadf8353443 /Source/cmNinjaNormalTargetGenerator.cxx
parent88c7abb7409c235d411c4cc899377385b91075e2 (diff)
downloadCMake-41eab150a8ef42bbebff18ff84652e9da1ef4e75.zip
CMake-41eab150a8ef42bbebff18ff84652e9da1ef4e75.tar.gz
CMake-41eab150a8ef42bbebff18ff84652e9da1ef4e75.tar.bz2
CUDA: Pass more link libraries to device linking
Previously we dropped non-target items from the device link line because nvcc rejects paths to shared library files, and only with target items do we know the kind of library. However, this also prevents projects from linking to system-provided libraries like `cublas_device` that contain device code. Fix this by passing more link items to device linking. Items that are not file paths, such as `-lfoo`, can simply be passed unconditionally. Items that are targets known to be shared libraries can still be skipped. Items that are paths to library files can be passed directly if they end in `.a`. Otherwise, pass them using `-Xnvlink` to bypass nvcc's front-end. The nvlink tool knows to ignore shared library files. Issue: #16317
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index f1fb2d2..52e3677 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -187,7 +187,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile)
std::string responseFlag;
if (!useResponseFile) {
vars.Objects = "$in";
- vars.LinkLibraries = "$LINK_LIBRARIES";
+ vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES";
} else {
std::string cmakeVarLang = "CMAKE_";
cmakeVarLang += this->TargetLinkLanguage;