summaryrefslogtreecommitdiffstats
path: root/Source/cmLinkLineDeviceComputer.cxx
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-06-27 20:00:01 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-01 12:29:10 (GMT)
commita4d502a5bfc38254ccb49615be8d7070fca6819e (patch)
treec80293ee702af53d38bc76bb0d53413a35389f62 /Source/cmLinkLineDeviceComputer.cxx
parent753373579e3dd8cf19f0fc18f4d9bec43a2d82e8 (diff)
downloadCMake-a4d502a5bfc38254ccb49615be8d7070fca6819e.zip
CMake-a4d502a5bfc38254ccb49615be8d7070fca6819e.tar.gz
CMake-a4d502a5bfc38254ccb49615be8d7070fca6819e.tar.bz2
CUDA: Do not device link if CUDA is not an enabled language
Checks added in commit 81b4d10d8f (CUDA: More exhaustive checks to determine when to do device linking, 2019-05-09, v3.15.0-rc1~82^2) assumed that CUDA properties would be set only if CUDA is enabled. We cannot do a device link step if we do not have the CUDA language enabled. This was discovered as some projects unconditionally set CUDA properties such as `CUDA_RESOLVE_DEVICE_SYMBOLS` even when the CUDA language has not been enabled. Fixes: #19432
Diffstat (limited to 'Source/cmLinkLineDeviceComputer.cxx')
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 6cfe5bb..d27da3e 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -12,6 +12,7 @@
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
@@ -142,6 +143,9 @@ std::string cmLinkLineDeviceComputer::GetLinkerLanguage(cmGeneratorTarget*,
bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
const std::string& config)
{
+ if (!target.GetGlobalGenerator()->GetLanguageEnabled("CUDA")) {
+ return false;
+ }
if (target.GetType() == cmStateEnums::OBJECT_LIBRARY) {
return false;