summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx33
1 files changed, 26 insertions, 7 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 16eca96..2d39cbb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1125,6 +1125,9 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
if (this->IPOEnabledConfigurations.count(config) > 0) {
e1.Element("WholeProgramOptimization", "true");
}
+ if (this->SpectreMitigationConfigurations.count(config) > 0) {
+ e1.Element("SpectreMitigation", "Spectre");
+ }
}
void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
@@ -2625,6 +2628,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
}
+ if (clOptions.HasFlag("SpectreMitigation")) {
+ this->SpectreMitigationConfigurations.insert(configName);
+ clOptions.RemoveFlag("SpectreMitigation");
+ }
+
this->ClOptions[configName] = std::move(pOptions);
return true;
}
@@ -2671,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);
}
@@ -2811,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