summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudioGeneratorOptions.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-16 13:24:40 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-05-16 13:24:53 (GMT)
commita9a93b1e33821b93497387eaee89862e738bb405 (patch)
tree2d76fbef0d9fc20ccf1b0efdaa9429574a339638 /Source/cmVisualStudioGeneratorOptions.cxx
parent7a390edefbc5de670f9b5cab60d282df2e22f548 (diff)
parent9fe41ecf36bc29f900ca0f9b81ca39d65d10296f (diff)
downloadCMake-a9a93b1e33821b93497387eaee89862e738bb405.zip
CMake-a9a93b1e33821b93497387eaee89862e738bb405.tar.gz
CMake-a9a93b1e33821b93497387eaee89862e738bb405.tar.bz2
Merge topic 'cuda-arch-off-vs'
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/cmVisualStudioGeneratorOptions.cxx')
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index d5d08b8..00c65ed 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];