From feeb9ae4ba8c162a84d9f7eb65ddde35eb9329a1 Mon Sep 17 00:00:00 2001 From: Fredrik Claesson Date: Wed, 13 Jul 2022 16:12:15 +0200 Subject: VS: Add support for (lib)fuzzer /fsanitize=fuzzer flag --- Source/cmVisualStudio10TargetGenerator.cxx | 9 +++++++++ Source/cmVisualStudio10TargetGenerator.h | 1 + 2 files changed, 10 insertions(+) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a7460e8..809617a 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1557,6 +1557,10 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( this->ASanEnabledConfigurations.end()) { e1.Element("EnableAsan", "true"); } + if (this->FuzzerEnabledConfigurations.find(config) != + this->FuzzerEnabledConfigurations.end()) { + e1.Element("EnableFuzzer", "true"); + } { auto s = this->SpectreMitigation.find(config); if (s != this->SpectreMitigation.end()) { @@ -3315,6 +3319,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( this->ASanEnabledConfigurations.insert(configName); } + // Check if (lib)Fuzzer is enabled. + if (flags.find("/fsanitize=fuzzer") != std::string::npos) { + this->FuzzerEnabledConfigurations.insert(configName); + } + // Precompile Headers std::string pchHeader = this->GeneratorTarget->GetPchHeader(configName, linkLanguage); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 7a0b8da..08182b9 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -231,6 +231,7 @@ private: bool TargetCompileAsWinRT; std::set IPOEnabledConfigurations; std::set ASanEnabledConfigurations; + std::set FuzzerEnabledConfigurations; std::map SpectreMitigation; cmGlobalVisualStudio10Generator* const GlobalGenerator; cmLocalVisualStudio10Generator* const LocalGenerator; -- cgit v0.12