From bd8b5401cfb2088d5e5494d04236eda36278da8b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20St=C3=BCrmer?= <michael.stuermer@schaeffler.com>
Date: Tue, 7 Mar 2017 11:40:31 +0100
Subject: [PATCH] VS: Do not treat custom targets as CSharp targets

Fixes: #16697
---
 Source/cmGlobalVisualStudioGenerator.cxx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index cc2536c439..ced0c266b8 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -750,6 +750,10 @@ bool cmGlobalVisualStudioGenerator::TargetIsCSharpOnly(
     if (!gt->GetConfigCommonSourceFiles(sources)) {
       return false;
     }
+    // Only "real" targets are allowed to be C# targets.
+    if (gt->Target->GetType() > cmStateEnums::OBJECT_LIBRARY) {
+      return false;
+    }
   }
   gt->GetLanguages(languages, "");
   if (languages.size() == 1) {
-- 
GitLab