diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2019-06-27 20:00:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-07-01 12:29:10 (GMT) |
commit | a4d502a5bfc38254ccb49615be8d7070fca6819e (patch) | |
tree | c80293ee702af53d38bc76bb0d53413a35389f62 /Source/cmMakefileLibraryTargetGenerator.cxx | |
parent | 753373579e3dd8cf19f0fc18f4d9bec43a2d82e8 (diff) | |
download | CMake-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/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 99f0df8..b9f7c6d 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -123,8 +123,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() { - - bool requiresDeviceLinking = requireDeviceLinking( + const bool requiresDeviceLinking = requireDeviceLinking( *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName); if (requiresDeviceLinking) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; @@ -152,7 +151,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) } if (!relink) { - bool requiresDeviceLinking = requireDeviceLinking( + const bool requiresDeviceLinking = requireDeviceLinking( *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName); if (requiresDeviceLinking) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; @@ -186,9 +185,8 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) { - if (!relink) { - bool requiresDeviceLinking = requireDeviceLinking( + const bool requiresDeviceLinking = requireDeviceLinking( *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName); if (requiresDeviceLinking) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; |