summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileExecutableTargetGenerator.cxx
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-05-09 13:13:39 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2019-05-21 15:40:07 (GMT)
commit81b4d10d8f421242f9989ff0c2d37a12be66f405 (patch)
tree74ee6499eb43e48f18dd41ff0b0b1bdd809768cc /Source/cmMakefileExecutableTargetGenerator.cxx
parent3205c7c950d5b90d47ce1c5c58073e511339b78c (diff)
downloadCMake-81b4d10d8f421242f9989ff0c2d37a12be66f405.zip
CMake-81b4d10d8f421242f9989ff0c2d37a12be66f405.tar.gz
CMake-81b4d10d8f421242f9989ff0c2d37a12be66f405.tar.bz2
CUDA: More exhaustive checks to determine when to do device linking
Previously CMake used fairly naive logic to determine when to do device linking which caused unnecessary device linking to occur frequently. We now use a more exhaustive algorithm to determine when we have a need for device linking. Fixes: #19238
Diffstat (limited to 'Source/cmMakefileExecutableTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx18
1 files changed, 3 insertions, 15 deletions
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index beabf91..1113a2c 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileExecutableTargetGenerator.h"
-#include <algorithm>
#include <memory> // IWYU pragma: keep
#include <set>
#include <sstream>
@@ -87,20 +86,9 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
return;
}
- const std::string cuda_lang("CUDA");
- cmGeneratorTarget::LinkClosure const* closure =
- this->GeneratorTarget->GetLinkClosure(this->ConfigName);
-
- const bool hasCUDA =
- (std::find(closure->Languages.begin(), closure->Languages.end(),
- cuda_lang) != closure->Languages.end());
-
- bool doDeviceLinking = true;
- if (const char* resolveDeviceSymbols =
- this->GeneratorTarget->GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
- doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols);
- }
- if (!hasCUDA || !doDeviceLinking) {
+ bool requiresDeviceLinking = requireDeviceLinking(
+ *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
+ if (!requiresDeviceLinking) {
return;
}