diff options
author | Brad King <brad.king@kitware.com> | 2018-10-10 17:14:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-10 17:29:47 (GMT) |
commit | 592064e026b1a3d6402496b5d37199e213569665 (patch) | |
tree | fbf4c8e96dc9aea22e9e2eeb17d59144900b7586 /Source | |
parent | fb378fc4d756bf8424bca9c94c4d498b7c6974de (diff) | |
download | CMake-592064e026b1a3d6402496b5d37199e213569665.zip CMake-592064e026b1a3d6402496b5d37199e213569665.tar.gz CMake-592064e026b1a3d6402496b5d37199e213569665.tar.bz2 |
VS: Drop workaround for CUDA compiler PDB location on CUDA 9.2+
The workaround added by commit v3.12.0-rc1~227^2 (VS: Add workaround for
CUDA compiler PDB location, 2018-04-13) is not necessary on CUDA 9.2+
because the CUDA Toolkit Visual Studio Integration has fixed the
original bug and forwards the `ProgramDataBaseFileName` to the host
compiler itself. Make the workaround conditional on the CUDA version.
Issue: #18440
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 16eca96..9c95cc5 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2811,15 +2811,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 |