summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-12-05 16:57:47 (GMT)
committerBrad King <brad.king@kitware.com>2018-12-05 19:45:19 (GMT)
commit7b7421346194896109a304ff088630f37ab2bd9e (patch)
treef640077078c7b5233708b61d49fc29b494b1966e /Source/cmVisualStudio10TargetGenerator.cxx
parent62942969062fcc9f24ca057b6983532a973cfad6 (diff)
downloadCMake-7b7421346194896109a304ff088630f37ab2bd9e.zip
CMake-7b7421346194896109a304ff088630f37ab2bd9e.tar.gz
CMake-7b7421346194896109a304ff088630f37ab2bd9e.tar.bz2
CUDA: Fix crash on linking to a CUDA target without CUDA enabled
Do not try to device link or add CUDA runtime libraries if the language is not enabled. Fixes: #18673 Issue: #18614
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 334c15b..d5e834b 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3331,7 +3331,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::vector<std::string> vsTargetVec;
this->AddLibraries(cli, libVec, vsTargetVec, config);
if (std::find(linkClosure->Languages.begin(), linkClosure->Languages.end(),
- "CUDA") != linkClosure->Languages.end()) {
+ "CUDA") != linkClosure->Languages.end() &&
+ this->CudaOptions[config] != nullptr) {
switch (this->CudaOptions[config]->GetCudaRuntime()) {
case cmVisualStudioGeneratorOptions::CudaRuntimeStatic:
libVec.push_back("cudadevrt.lib");