diff options
author | Brad King <brad.king@kitware.com> | 2022-06-17 15:29:47 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-06-17 15:29:54 (GMT) |
commit | 4f7291928b2355f9438a353c91c84ef6bfa7501f (patch) | |
tree | d998d2b0e149fcdc632c8dd787b6fbab0e7e86f9 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 467d0e01f871fdbbc57b7403939bd50195b92631 (diff) | |
parent | e3983168dace026301b6b398691ffb66b6c816e4 (diff) | |
download | CMake-4f7291928b2355f9438a353c91c84ef6bfa7501f.zip CMake-4f7291928b2355f9438a353c91c84ef6bfa7501f.tar.gz CMake-4f7291928b2355f9438a353c91c84ef6bfa7501f.tar.bz2 |
Merge topic 'msvc_cuda_pass_arch_flags_in_additional_options'
e3983168da CUDA: MSVC pass all cuda gencode flags via AdditionalOptions
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7359
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 d51aed2..6826ea9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3856,21 +3856,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, |