From c89e8522bbe0d5526b2d2e6751511fe9737b37e8 Mon Sep 17 00:00:00 2001
From: Tomoki Imai <Tomoki.Imai@sony.com>
Date: Sat, 2 Dec 2017 20:54:55 +0900
Subject: cmGlobalGenerator: Add IsIncludeExternalMSProjectSupported method

---
 Source/cmGlobalGenerator.h             | 4 ++++
 Source/cmGlobalVisualStudioGenerator.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 8fcb533..abc451a 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -358,6 +358,10 @@ public:
 
   virtual bool IsIPOSupported() const { return false; }
 
+  /** Return whether the generator can import external visual studio project
+      using INCLUDE_EXTERNAL_MSPROJECT */
+  virtual bool IsIncludeExternalMSProjectSupported() const { return false; }
+
   /** Return whether the generator should use EFFECTIVE_PLATFORM_NAME. This is
       relevant for mixed macOS and iOS builds. */
   virtual bool UseEffectivePlatformName(cmMakefile*) const { return false; }
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 55a6813..f4fc3cf 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -101,6 +101,8 @@ public:
   /** Return true if building for Windows CE */
   virtual bool TargetsWindowsCE() const { return false; }
 
+  bool IsIncludeExternalMSProjectSupported() const override { return true; }
+
   class TargetSet : public std::set<cmGeneratorTarget const*>
   {
   };
-- 
cgit v0.12


From 2c06e9e73ed2214f0f96e392ca2a35f74ee6efa6 Mon Sep 17 00:00:00 2001
From: Tomoki Imai <Tomoki.Imai@sony.com>
Date: Sun, 26 Nov 2017 20:29:03 +0900
Subject: include_external_msproject: Support non-Windows target platforms

Allow the command on any generator that supports it, even if
the target platform does not define `WIN32`.

Fixes: #17511
---
 Source/cmIncludeExternalMSProjectCommand.cxx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx
index bd16b1d..85e8cd3 100644
--- a/Source/cmIncludeExternalMSProjectCommand.cxx
+++ b/Source/cmIncludeExternalMSProjectCommand.cxx
@@ -3,6 +3,7 @@
 #include "cmIncludeExternalMSProjectCommand.h"
 
 #ifdef _WIN32
+#include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmStateTypes.h"
 #include "cmSystemTools.h"
@@ -22,7 +23,9 @@ bool cmIncludeExternalMSProjectCommand::InitialPass(
   }
 // only compile this for win32 to avoid coverage errors
 #ifdef _WIN32
-  if (this->Makefile->GetDefinition("WIN32")) {
+  if (this->Makefile->GetDefinition("WIN32") ||
+      this->Makefile->GetGlobalGenerator()
+        ->IsIncludeExternalMSProjectSupported()) {
     enum Doing
     {
       DoingNone,
-- 
cgit v0.12