diff options
author | Brad King <brad.king@kitware.com> | 2018-10-08 17:51:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-08 18:03:39 (GMT) |
commit | bb60ed6e724b2891a33f3cd5b6e5aa300dcc4180 (patch) | |
tree | 815be526387f22f1492391446521a66c11ab919a | |
parent | fd02538974dd952a8639d371c2c0067d30d5469a (diff) | |
download | CMake-bb60ed6e724b2891a33f3cd5b6e5aa300dcc4180.zip CMake-bb60ed6e724b2891a33f3cd5b6e5aa300dcc4180.tar.gz CMake-bb60ed6e724b2891a33f3cd5b6e5aa300dcc4180.tar.bz2 |
VS: Add flag table entry for -Qspectre
Add special logic to map this flag to a top-level build setting
instead of being in ClCompile.
Fixes: #18426
-rw-r--r-- | Source/cmVS141CLFlagTable.h | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.h | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmVS141CLFlagTable.h b/Source/cmVS141CLFlagTable.h index 7d3e356..2a9944a 100644 --- a/Source/cmVS141CLFlagTable.h +++ b/Source/cmVS141CLFlagTable.h @@ -83,6 +83,8 @@ static cmVS7FlagTable cmVS141CLFlagTable[] = { { "FloatingPointModel", "fp:strict", "Strict", "Strict", 0 }, { "FloatingPointModel", "fp:fast", "Fast", "Fast", 0 }, + { "SpectreMitigation", "Qspectre", "Spectre mitigations", "Spectre", 0 }, + { "LanguageStandard", "std:c++17", "ISO C++17 Standard", "stdcpp17", 0 }, { "LanguageStandard", "std:c++14", "ISO C++14 Standard", "stdcpp14", 0 }, { "LanguageStandard", "std:c++latest", "ISO C++ Latest Draft Standard", diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 16eca96..57d66e0 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; } diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 829d2bf..0dc03b6 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -205,6 +205,7 @@ private: unsigned int NsightTegraVersion[4]; bool TargetCompileAsWinRT; std::set<std::string> IPOEnabledConfigurations; + std::set<std::string> SpectreMitigationConfigurations; cmGlobalVisualStudio10Generator* const GlobalGenerator; cmLocalVisualStudio10Generator* const LocalGenerator; std::set<std::string> CSharpCustomCommandNames; |