diff options
author | Brad King <brad.king@kitware.com> | 2018-10-10 17:41:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-10 17:41:44 (GMT) |
commit | bcfb2457030efcfdb84eef02230aa47f18072555 (patch) | |
tree | ec0fe92e5d05b7ef04f383e1e5b02b8db7a6da60 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | a8a485715afe3017a514bc5fbd3a19a96d493aed (diff) | |
parent | faf3d7d224ae2292e88b8238271a7ff97950ddf9 (diff) | |
download | CMake-bcfb2457030efcfdb84eef02230aa47f18072555.zip CMake-bcfb2457030efcfdb84eef02230aa47f18072555.tar.gz CMake-bcfb2457030efcfdb84eef02230aa47f18072555.tar.bz2 |
Merge branch 'vs-cuda-pdb' into release-3.13
Merge-request: !2473
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 57d66e0..2d39cbb 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2679,6 +2679,13 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( // Specify the compiler program database file if configured. std::string pdb = this->GeneratorTarget->GetCompilePDBPath(configName); if (!pdb.empty()) { + if (this->GlobalGenerator->IsCudaEnabled()) { + // CUDA does not quote paths with spaces correctly when forwarding + // this to the host compiler. Use a relative path to avoid spaces. + // FIXME: We can likely do this even when CUDA is not involved, + // but for now we will make a minimal change. + pdb = this->ConvertPath(pdb, true); + } ConvertToWindowsSlash(pdb); e2.Element("ProgramDataBaseFileName", pdb); } @@ -2819,15 +2826,19 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( // 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. + // CUDA does not make the directory if it is non-standard. 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); + if (cmSystemTools::VersionCompareGreaterEq( + "9.2", this->GlobalGenerator->GetPlatformToolsetCudaString())) { + // 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. + 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 |