summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-04 15:27:37 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-05-04 15:27:43 (GMT)
commit8314edd065a746e0e2c83dc524a6712a184b635b (patch)
tree8e4ae66f0640efafc328f925da80d70a1012c76f /Source/cmVisualStudio10TargetGenerator.cxx
parenta0594739d1ee422fd27581ac914c178ef39b0339 (diff)
parentd8786bfa16889f445a37bee7e665948e7a134c13 (diff)
downloadCMake-8314edd065a746e0e2c83dc524a6712a184b635b.zip
CMake-8314edd065a746e0e2c83dc524a6712a184b635b.tar.gz
CMake-8314edd065a746e0e2c83dc524a6712a184b635b.tar.bz2
Merge topic 'vs-config-specific-csproj'
d8786bfa16 VS: Add support for per-config C# sources Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6055
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index cc1586d..ba0cf9c 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2277,6 +2277,20 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
std::back_inserter(exclude_configs));
Elem e2(e1, tool);
+ bool isCSharp = (si.Source->GetLanguage() == "CSharp");
+ if (isCSharp && exclude_configs.size() > 0) {
+ std::stringstream conditions;
+ bool firstConditionSet{ false };
+ for (const auto& ci : include_configs) {
+ if (firstConditionSet) {
+ conditions << " Or ";
+ }
+ conditions << "('$(Configuration)|$(Platform)'=='" +
+ this->Configurations[ci] + "|" + this->Platform + "')";
+ firstConditionSet = true;
+ }
+ e2.Attribute("Condition", conditions.str());
+ }
this->WriteSource(e2, si.Source);
bool useNativeUnityBuild = false;
@@ -2321,7 +2335,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
if (si.Source->GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS")) {
e2.Element("PrecompiledHeader", "NotUsing");
}
- if (!exclude_configs.empty()) {
+ if (!isCSharp && !exclude_configs.empty()) {
this->WriteExcludeFromBuild(e2, exclude_configs);
}
}