summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-10-24 14:46:06 (GMT)
committerBrad King <brad.king@kitware.com>2018-10-24 14:52:46 (GMT)
commitd81c4db489d773e4a1ce6be49eb9c41582e68ae3 (patch)
tree512d4e46d43003c862442e588c26f12460cb2123 /Source
parent5d481919d499f6de1dd079bf732f32ec3f085101 (diff)
parent2cc050b53b4afb1ed62621360b860e25b7c46015 (diff)
downloadCMake-d81c4db489d773e4a1ce6be49eb9c41582e68ae3.zip
CMake-d81c4db489d773e4a1ce6be49eb9c41582e68ae3.tar.gz
CMake-d81c4db489d773e4a1ce6be49eb9c41582e68ae3.tar.bz2
Merge branch 'cuda-thread-flags' into release-3.13
Merge-request: !2512
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index c9bbde1..025c6e4 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -25,6 +25,23 @@ cmLinkLineDeviceComputer::~cmLinkLineDeviceComputer()
{
}
+static bool cmLinkItemValidForDevice(std::string const& item)
+{
+ // Valid items are:
+ // * Non-flags (does not start in '-')
+ // * Specific flags --library, --library-path, -l, -L
+ // For example:
+ // * 'cublas_device' => pass-along
+ // * '--library pthread' => pass-along
+ // * '-lpthread' => pass-along
+ // * '-pthread' => drop
+ // * '-a' => drop
+ return (!cmHasLiteralPrefix(item, "-") || //
+ cmHasLiteralPrefix(item, "-l") || //
+ cmHasLiteralPrefix(item, "-L") || //
+ cmHasLiteralPrefix(item, "--library"));
+}
+
std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
cmComputeLinkInformation& cli, std::string const& stdLibString)
{
@@ -69,7 +86,7 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
}
out +=
this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value));
- } else {
+ } else if (cmLinkItemValidForDevice(item.Value)) {
out += item.Value;
}