diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-06-16 12:13:57 (GMT) |
---|---|---|
committer | Robert Maynard <rmaynard@nvidia.com> | 2022-06-16 12:13:57 (GMT) |
commit | e3983168dace026301b6b398691ffb66b6c816e4 (patch) | |
tree | 3860ca677e49a62cb3371aec23a6a5dce8026ced /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 87273cc9d3b7073a1c175f73b241be16b566b47c (diff) | |
download | CMake-e3983168dace026301b6b398691ffb66b6c816e4.zip CMake-e3983168dace026301b6b398691ffb66b6c816e4.tar.gz CMake-e3983168dace026301b6b398691ffb66b6c816e4.tar.bz2 |
CUDA: MSVC pass all cuda gencode flags via AdditionalOptions
Fixes #23491
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index c79331c..8e1c06e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3852,21 +3852,28 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions( this->GeneratorTarget->GetLinkOptions(linkOpts, configName, "CUDA"); // LINK_OPTIONS are escaped. this->LocalGenerator->AppendCompileOptions(linkFlags, linkOpts); + + cmComputeLinkInformation* pcli = + this->GeneratorTarget->GetLinkInformation(configName); + if (doDeviceLinking && pcli) { + + cmLinkLineDeviceComputer computer( + this->LocalGenerator, + this->LocalGenerator->GetStateSnapshot().GetDirectory()); + std::string ignored_; + this->LocalGenerator->GetDeviceLinkFlags(computer, configName, ignored_, + linkFlags, ignored_, ignored_, + this->GeneratorTarget); + + this->LocalGenerator->AddLanguageFlagsForLinking( + linkFlags, this->GeneratorTarget, "CUDA", configName); + } cudaLinkOptions.AppendFlagString("AdditionalOptions", linkFlags); // For static libraries that have device linking enabled compute // the libraries if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY && doDeviceLinking) { - cmComputeLinkInformation* pcli = - this->GeneratorTarget->GetLinkInformation(configName); - if (!pcli) { - cmSystemTools::Error( - "CMake can not compute cmComputeLinkInformation for target: " + - this->Name); - return false; - } - cmComputeLinkInformation& cli = *pcli; cmLinkLineDeviceComputer computer( this->LocalGenerator, |