diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2019-01-31 22:34:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-02-05 16:09:48 (GMT) |
commit | 850ef90a66a8f81369b3d11c74398ccaefbe5324 (patch) | |
tree | ff067fd297cbb3f4dd34938a36e5594c5dd23f36 /Source/cmMakefileLibraryTargetGenerator.cxx | |
parent | 6e91f5d6204e650c808b6585074faa248ee6e6a9 (diff) | |
download | CMake-850ef90a66a8f81369b3d11c74398ccaefbe5324.zip CMake-850ef90a66a8f81369b3d11c74398ccaefbe5324.tar.gz CMake-850ef90a66a8f81369b3d11c74398ccaefbe5324.tar.bz2 |
CUDA: Honor CUDA_RESOLVE_DEVICE_SYMBOLS for more target types
`CUDA_RESOLVE_DEVICE_SYMBOLS` can be used with shared, module, and
executable target types. This relaxation is to allow for better
interoperability with linkers that automatically do CUDA device symbol
resolution and have no way to disable it.
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 72181ab..5a1ef4e 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -133,9 +133,12 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() (std::find(closure->Languages.begin(), closure->Languages.end(), cuda_lang) != closure->Languages.end()); - const bool resolveDeviceSymbols = - this->GeneratorTarget->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS"); - if (hasCUDA && resolveDeviceSymbols) { + bool doDeviceLinking = false; + if (const char* resolveDeviceSymbols = + this->GeneratorTarget->GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) { + doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols); + } + if (hasCUDA && doDeviceLinking) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; this->WriteDeviceLibraryRules(linkRuleVar, false); } @@ -168,7 +171,12 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) const bool hasCUDA = (std::find(closure->Languages.begin(), closure->Languages.end(), cuda_lang) != closure->Languages.end()); - if (hasCUDA) { + bool doDeviceLinking = true; + if (const char* resolveDeviceSymbols = + this->GeneratorTarget->GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) { + doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols); + } + if (hasCUDA && doDeviceLinking) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; this->WriteDeviceLibraryRules(linkRuleVar, relink); } @@ -209,7 +217,12 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) const bool hasCUDA = (std::find(closure->Languages.begin(), closure->Languages.end(), cuda_lang) != closure->Languages.end()); - if (hasCUDA) { + bool doDeviceLinking = true; + if (const char* resolveDeviceSymbols = + this->GeneratorTarget->GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) { + doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols); + } + if (hasCUDA && doDeviceLinking) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; this->WriteDeviceLibraryRules(linkRuleVar, relink); } |