VS: Set CUDA TargetMachinePlatform explicitly on x64

The `TargetMachinePlatform` setting tells CUDA what `--machine {32,64}`
flag to pass to nvcc.  While CUDA automatically chooses the proper
default for the target architecture, it does not reflect this in the
user-visible IDE settings.  Set it explicitly to fix the user-visible
setting.

Fixes: #17355
This commit is contained in:
Brad King
2017-10-17 10:32:34 -04:00
parent a91eb5e41f
commit fd90a14f1b

View File

@@ -2648,6 +2648,13 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
cudaOptions.AddFlag("CompileOut", "$(IntDir)%(Filename).ptx");
}
// CUDA automatically passes the proper '--machine' flag to nvcc
// for the current architecture, but does not reflect this default
// in the user-visible IDE settings. Set it explicitly.
if (this->Platform == "x64") {
cudaOptions.AddFlag("TargetMachinePlatform", "64");
}
// Convert the host compiler options to the toolset's abstractions
// using a secondary flag table.
cudaOptions.ClearTables();