Browse Source

Merge topic 'vs-cuda'

a9210a0c02 VS: Restore support for CUDA with no optimization flags

Acked-by: Kitware Robot <[email protected]>
Acked-by: Robert Maynard <[email protected]>
Merge-request: !9666
Brad King 1 year ago
parent
commit
f2e52b3124
1 changed files with 8 additions and 0 deletions
  1. 8 0
      Source/cmVisualStudio10TargetGenerator.cxx

+ 8 - 0
Source/cmVisualStudio10TargetGenerator.cxx

@@ -3893,6 +3893,14 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
     cudaOptions.AddFlag("CudaRuntime", "None");
   }
 
+  if (this->ProjectType == VsProjectType::vcxproj && this->MSTools) {
+    // Suppress inheritance of host compiler optimization flags
+    // when the project does not specify any optimization flags for CUDA.
+    if (!cudaOptions.HasFlag("Optimization")) {
+      cudaOptions.AddFlag("Optimization", "");
+    }
+  }
+
   this->CudaOptions[configName] = std::move(pOptions);
   return true;
 }