diff options
author | Brad King <brad.king@kitware.com> | 2018-12-06 13:38:45 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-12-06 13:39:22 (GMT) |
commit | 0780a8f57ac6a593a53fe2fe9ce22c889a77d5fb (patch) | |
tree | dc4a3e75ce0f4a1ce4f3c866748a124ba01f6553 /Source | |
parent | 3542a553bf5149734c9002952795026ffbd06308 (diff) | |
parent | 7b7421346194896109a304ff088630f37ab2bd9e (diff) | |
download | CMake-0780a8f57ac6a593a53fe2fe9ce22c889a77d5fb.zip CMake-0780a8f57ac6a593a53fe2fe9ce22c889a77d5fb.tar.gz CMake-0780a8f57ac6a593a53fe2fe9ce22c889a77d5fb.tar.bz2 |
Merge topic 'cuda-external'
7b74213461 CUDA: Fix crash on linking to a CUDA target without CUDA enabled
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2704
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 3 |
3 files changed, 10 insertions, 1 deletions
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 08bb2ce..846b12c 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -84,6 +84,10 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( bool relink) { #ifdef CMAKE_BUILD_WITH_CMAKE + if (!this->GlobalGenerator->GetLanguageEnabled("CUDA")) { + return; + } + const std::string cuda_lang("CUDA"); cmGeneratorTarget::LinkClosure const* closure = this->GeneratorTarget->GetLinkClosure(this->ConfigName); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 1386706..c953d20 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -557,6 +557,10 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd() void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() { + if (!this->GetGlobalGenerator()->GetLanguageEnabled("CUDA")) { + return; + } + cmGeneratorTarget& genTarget = *this->GetGeneratorTarget(); // determine if we need to do any device linking for this target diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index e9a1a67..7d7defc 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3319,7 +3319,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"); |