瀏覽代碼

Merge topic 'cuda-arch-off-vs'

9fe41ecf36 VS: Fix CUDA CodeGeneration field for CMAKE_CUDA_ARCHITECTURES=OFF

Acked-by: Kitware Robot <[email protected]>
Reviewed-by: Raul Tambre <[email protected]>
Merge-request: !7261
Brad King 3 年之前
父節點
當前提交
a9a93b1e33
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      Source/cmVisualStudioGeneratorOptions.cxx

+ 5 - 4
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];