diff options
author | Brad King <brad.king@kitware.com> | 2022-01-21 14:13:17 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-01-21 14:13:28 (GMT) |
commit | 54b1bb7cb3f15b26c211a2f0d7bd4f95ec9fd174 (patch) | |
tree | 24f8117d974f71c7b302e2363d86c68c795099cf /Source | |
parent | e2edcd561a31e1d22cc8973dc2bd0d30933154ad (diff) | |
parent | d13c8d25e6b27f0f676d39f1ff6c9197a1f7aeb7 (diff) | |
download | CMake-54b1bb7cb3f15b26c211a2f0d7bd4f95ec9fd174.zip CMake-54b1bb7cb3f15b26c211a2f0d7bd4f95ec9fd174.tar.gz CMake-54b1bb7cb3f15b26c211a2f0d7bd4f95ec9fd174.tar.bz2 |
Merge topic 'vs-asan'
d13c8d25e6 VS: Add support for ASAN -fsanitize=address flag
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6881
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 685d34d..96dcf0b 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1468,6 +1468,10 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( if (this->IPOEnabledConfigurations.count(config) > 0) { e1.Element("WholeProgramOptimization", "true"); } + if (this->ASanEnabledConfigurations.find(config) != + this->ASanEnabledConfigurations.end()) { + e1.Element("EnableAsan", "true"); + } { auto s = this->SpectreMitigation.find(config); if (s != this->SpectreMitigation.end()) { @@ -3075,6 +3079,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( this->IPOEnabledConfigurations.insert(configName); } + // Check if ASan is enabled. + if (flags.find("/fsanitize=address") != std::string::npos) { + this->ASanEnabledConfigurations.insert(configName); + } + // Precompile Headers std::string pchHeader = this->GeneratorTarget->GetPchHeader(configName, linkLanguage); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 8d2b77d..79aa5e8 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -229,6 +229,7 @@ private: unsigned int NsightTegraVersion[4]; bool TargetCompileAsWinRT; std::set<std::string> IPOEnabledConfigurations; + std::set<std::string> ASanEnabledConfigurations; std::map<std::string, std::string> SpectreMitigation; cmGlobalVisualStudio10Generator* const GlobalGenerator; cmLocalVisualStudio10Generator* const LocalGenerator; |