From f00e1b816d7220b700f7f8d24347d80b66e30c86 Mon Sep 17 00:00:00 2001 From: Matt Davies Date: Wed, 18 Mar 2020 12:38:38 +0000 Subject: VS: Add VS_SOURCE_SETTINGS_ target property VS_SOURCE_SETTINGS_ is a list of key value pairs that get written as item metadata for any file associated with for that target. The entire value of VS_SOURCE_SETTINGS_ is evaluated as a generator expression. VS_SETTINGS can override settings specified in this property. --- Source/cmVisualStudio10TargetGenerator.cxx | 16 ++++++++++++++++ Source/cmVisualStudio10TargetGenerator.h | 1 + 2 files changed, 17 insertions(+) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index d67fe72..7eaf625 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1967,6 +1967,22 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1, } } + if (ParsedToolTargetSettings.find(tool) == ParsedToolTargetSettings.end()) { + const char* toolTargetProperty = + this->GeneratorTarget->Target->GetProperty("VS_SOURCE_SETTINGS_" + + std::string(tool)); + ConfigToSettings toolTargetSettings; + ParseSettingsProperty(toolTargetProperty, toolTargetSettings); + + ParsedToolTargetSettings[tool] = toolTargetSettings; + } + + for (const auto& configToSetting : ParsedToolTargetSettings[tool]) { + for (const auto& setting : configToSetting.second) { + toolSettings[configToSetting.first][setting.first] = setting.second; + } + } + ParseSettingsProperty(sf->GetProperty("VS_SETTINGS"), toolSettings); if (!toolSettings.empty()) { diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 790811b..f5eb72b 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -241,6 +241,7 @@ private: using ConfigToSettings = std::unordered_map>; + std::unordered_map ParsedToolTargetSettings; bool PropertyIsSameInAllConfigs(const ConfigToSettings& toolSettings, const std::string& propName); void ParseSettingsProperty(const char* settingsPropertyValue, -- cgit v0.12