[cmake-developers] [PATCH] WINCE, VS: Allow selecting an SDK for Windows CE on Visual Studio

Pascal Bach pascal.bach at siemens.com
Wed Sep 3 13:16:11 EDT 2014


Set CMAKE_VS_WINCE_SDK to specify the SDK.
---
 Source/cmGlobalVisualStudio10Generator.cxx |   48 ++++++++++++++++++++++++++++
 Source/cmGlobalVisualStudio10Generator.h   |    7 ++++
 Source/cmGlobalVisualStudio11Generator.cxx |   12 +++++++
 Source/cmGlobalVisualStudio11Generator.h   |    2 ++
 Source/cmGlobalVisualStudio12Generator.cxx |   12 +++++++
 Source/cmGlobalVisualStudio12Generator.h   |    2 ++
 6 files changed, 83 insertions(+)

diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 19aa52c..5c1fd4b 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -165,6 +165,14 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
       return false;
       }
     }
+  else if (this->SystemName == "WindowsCE")
+    {
+    this->SystemIsWindowsCE = true;
+    if (!this->InitializeWindowsCE(mf))
+      {
+      return false;
+      }
+    }
   return true;
 }
 
@@ -187,6 +195,46 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
 }
 
 //----------------------------------------------------------------------------
+bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
+{
+  this->DefaultPlatformToolset = this->SelectWindowsCEToolset();
+  if (this->DefaultPlatformToolset.empty())
+  {
+    cmOStringStream e;
+    e << this->GetName() << " supports Windows CE '8.0', but not '"
+      << this->SystemVersion << "'.  Check CMAKE_SYSTEM_VERSION.";
+    mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+    return false;
+  }
+
+  if (const char* platformName = mf->GetDefinition("CMAKE_VS_WINCE_SDK"))
+  {
+    this->PlatformName = platformName;
+  }
+  else {
+    cmOStringStream e;
+    e << this->GetName() << " for " << this->GetSystemName() << " requires an SDK. Please set CMAKE_VS_WINCE_SDK to the name of your SDK.";
+    mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+    return false;
+  }
+
+  return true;
+}
+
+//----------------------------------------------------------------------------
+std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const
+{
+  if (this->SystemVersion == "8.0")
+  {
+  return "CE800";
+  }
+  else
+  {
+  return "";
+  }
+}
+
+//----------------------------------------------------------------------------
 void cmGlobalVisualStudio10Generator
 ::AddVSPlatformToolsetDefinition(cmMakefile* mf) const
 {
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 11fa954..9bceb2c 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -75,6 +75,10 @@ public:
   bool TargetsWindowsStore() const
     { return this->SystemIsWindowsStore; }
 
+  /** Return true if building for WindowsCE */
+  bool TargetsWindowsCE() const
+  { return this->SystemIsWindowsCE; }
+
   /**
    * Where does this version of Visual Studio look for macros for the
    * current user? Returns the empty string if this version of Visual
@@ -106,8 +110,10 @@ protected:
   virtual bool InitializeSystem(cmMakefile* mf);
   virtual bool InitializeWindowsPhone(cmMakefile* mf);
   virtual bool InitializeWindowsStore(cmMakefile* mf);
+  virtual bool InitializeWindowsCE(cmMakefile* mf);
   virtual std::string SelectWindowsPhoneToolset() const { return ""; }
   virtual std::string SelectWindowsStoreToolset() const { return ""; }
+  virtual std::string SelectWindowsCEToolset() const;
 
   virtual const char* GetIDEVersion() { return "10.0"; }
 
@@ -119,6 +125,7 @@ protected:
   std::string SystemVersion;
   bool SystemIsWindowsPhone;
   bool SystemIsWindowsStore;
+  bool SystemIsWindowsCE;
   bool ExpressEdition;
 
   bool UseFolderProperty();
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 39bbdc0..a71c42e 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -159,6 +159,12 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf)
 }
 
 //----------------------------------------------------------------------------
+bool cmGlobalVisualStudio11Generator::InitializeWindowsCE(cmMakefile* mf)
+{
+  return cmGlobalVisualStudio10Generator::InitializeWindowsCE(mf);
+}
+
+//----------------------------------------------------------------------------
 std::string cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset() const
 {
   if(this->SystemVersion == "8.0")
@@ -179,6 +185,12 @@ std::string cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset() const
 }
 
 //----------------------------------------------------------------------------
+std::string cmGlobalVisualStudio11Generator::SelectWindowsCEToolset() const
+{
+  return this->cmGlobalVisualStudio10Generator::SelectWindowsCEToolset();
+}
+
+//----------------------------------------------------------------------------
 void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
 {
   fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index bbd935c..9dd3271 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -36,8 +36,10 @@ public:
 protected:
   virtual bool InitializeWindowsPhone(cmMakefile* mf);
   virtual bool InitializeWindowsStore(cmMakefile* mf);
+  virtual bool InitializeWindowsCE(cmMakefile* mf);
   virtual std::string SelectWindowsPhoneToolset() const;
   virtual std::string SelectWindowsStoreToolset() const;
+  virtual std::string SelectWindowsCEToolset() const;
   virtual const char* GetIDEVersion() { return "11.0"; }
   bool UseFolderProperty();
   static std::set<std::string> GetInstalledWindowsCESDKs();
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 29ecfe0..c784cae 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -139,6 +139,12 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf)
 }
 
 //----------------------------------------------------------------------------
+bool cmGlobalVisualStudio12Generator::InitializeWindowsCE(cmMakefile* mf)
+{
+  return cmGlobalVisualStudio11Generator::InitializeWindowsCE(mf);
+}
+
+//----------------------------------------------------------------------------
 std::string cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset() const
 {
   if(this->SystemVersion == "8.1")
@@ -159,6 +165,12 @@ std::string cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset() const
 }
 
 //----------------------------------------------------------------------------
+std::string cmGlobalVisualStudio12Generator::SelectWindowsCEToolset() const
+{
+  return this->cmGlobalVisualStudio11Generator::SelectWindowsCEToolset();
+}
+
+//----------------------------------------------------------------------------
 void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout)
 {
   fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index ec85f10..5d8c125 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -41,8 +41,10 @@ public:
 protected:
   virtual bool InitializeWindowsPhone(cmMakefile* mf);
   virtual bool InitializeWindowsStore(cmMakefile* mf);
+  virtual bool InitializeWindowsCE(cmMakefile* mf);
   virtual std::string SelectWindowsPhoneToolset() const;
   virtual std::string SelectWindowsStoreToolset() const;
+  virtual std::string SelectWindowsCEToolset() const;
   virtual const char* GetIDEVersion() { return "12.0"; }
 private:
   class Factory;
-- 
1.7.10.4



More information about the cmake-developers mailing list