summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-16 13:13:58 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-04-16 13:14:05 (GMT)
commit5099af044fc737fef6215ccacdce3bb4c9f3d957 (patch)
tree11fee1f6f3cc73070c3815abc4abcd12b8683e64 /Source/cmVisualStudio10TargetGenerator.cxx
parent5e4c5b53e165fe6dd87eb766d3d21889914086dd (diff)
parent134e795fa968a06e289f1449b6ca4bf4702da03b (diff)
downloadCMake-5099af044fc737fef6215ccacdce3bb4c9f3d957.zip
CMake-5099af044fc737fef6215ccacdce3bb4c9f3d957.tar.gz
CMake-5099af044fc737fef6215ccacdce3bb4c9f3d957.tar.bz2
Merge topic 'vs-cuda-pdb'
134e795fa9 VS: Add workaround for CUDA compiler PDB location Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1960
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 609ccf2..cabe89f 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2697,6 +2697,20 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
cudaOptions.AppendFlagString("AdditionalOptions", "-x cu");
}
+ // Specify the compiler program database file if configured.
+ std::string pdb = this->GeneratorTarget->GetCompilePDBPath(configName);
+ if (!pdb.empty()) {
+ // CUDA does not have a field for this and does not honor the
+ // ProgramDataBaseFileName field in ClCompile. Work around this
+ // limitation by creating the directory and passing the flag ourselves.
+ std::string const pdbDir = cmSystemTools::GetFilenamePath(pdb);
+ cmSystemTools::MakeDirectory(pdbDir);
+ pdb = this->ConvertPath(pdb, true);
+ ConvertToWindowsSlash(pdb);
+ std::string const clFd = "-Xcompiler=\"-Fd\\\"" + pdb + "\\\"\"";
+ cudaOptions.AppendFlagString("AdditionalOptions", clFd);
+ }
+
// 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.