summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-16 13:24:40 +0000
committerKitware Robot <kwrobot@kitware.com>2022-05-16 09:24:52 -0400
commit29d23ec2cf8c24d408a8f9f227c5b52152e2f8d0 (patch)
treeac8bc634d6f1d51bf8cb741ee2c62e332dfee74a /Source
parentc1d980f722caaf4d2c7a1ec371ff871aeeb5c9c9 (diff)
parent9fe41ecf36bc29f900ca0f9b81ca39d65d10296f (diff)
downloadcmake-29d23ec2cf8c24d408a8f9f227c5b52152e2f8d0.tar.gz
Merge topic 'cuda-arch-off-vs' into release-3.23
9fe41ecf36 VS: Fix CUDA CodeGeneration field for CMAKE_CUDA_ARCHITECTURES=OFF Acked-by: Kitware Robot <kwrobot@kitware.com> Reviewed-by: Raul Tambre <raul@tambre.ee> Merge-request: !7261
Diffstat (limited to 'Source')
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 9045a4dac1..0b27dfb9c5 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -171,14 +171,15 @@ void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration()
code.clear();
}
- if (arch.empty() && gencode.empty()) {
- return;
- }
-
// Create a CodeGeneration field with [arch],[code] syntax in each entry.
// CUDA will convert it to `-gencode=arch=[arch],code="[code],[arch]"`.
FlagValue& result = this->FlagMap["CodeGeneration"];
+ // If there are no flags, leave the CodeGeneration field empty.
+ if (arch.empty() && gencode.empty()) {
+ return;
+ }
+
// First entries for the -arch=<arch> [-code=<code>,...] pair.
if (!arch.empty()) {
std::string arch_name = arch[0];