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
This commit is contained in:
Robert Maynard
2019-06-27 16:00:01 -04:00
committed by Brad King
parent 753373579e
commit a4d502a5bf
8 changed files with 38 additions and 11 deletions
@@ -82,11 +82,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
bool relink)
{
#ifdef CMAKE_BUILD_WITH_CMAKE
if (!this->GlobalGenerator->GetLanguageEnabled("CUDA")) {
return;
}
bool requiresDeviceLinking = requireDeviceLinking(
const bool requiresDeviceLinking = requireDeviceLinking(
*this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
if (!requiresDeviceLinking) {
return;