summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-10-24 14:23:55 (GMT)
committerBrad King <brad.king@kitware.com>2018-10-24 14:23:55 (GMT)
commitd17755f9cf583387fab83ad5744b93c746aa5994 (patch)
treebf8197723cd2a7281b3aa3010127bde4ce6bba61
parent32fdbd57a86e5d350d72de3ebdb60e6ea20de717 (diff)
parente768d96c74579c79e184027775e51b08cd77fe45 (diff)
downloadCMake-d17755f9cf583387fab83ad5744b93c746aa5994.zip
CMake-d17755f9cf583387fab83ad5744b93c746aa5994.tar.gz
CMake-d17755f9cf583387fab83ad5744b93c746aa5994.tar.bz2
Merge branch 'cuda-filter-device-link-items' into release-3.12
Merge-request: !2512
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 557fa41..470f394 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -23,6 +23,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)
{
@@ -60,7 +77,7 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
}
fout << this->ConvertToOutputFormat(
this->ConvertToLinkReference(item.Value));
- } else {
+ } else if (cmLinkItemValidForDevice(item.Value)) {
fout << item.Value;
}
fout << " ";