[Cmake-commits] CMake branch, next, updated. v3.7.0-rc2-755-g24e5bff

Brad King brad.king at kitware.com
Tue Oct 25 09:52:59 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  24e5bff0eb7e82d34775a029296858b8142ff02f (commit)
       via  69fc7bf87db33d88af02602fba811b5c5e740a70 (commit)
       via  e2ed9a70929092ab7b32e036886859e53fbff897 (commit)
       via  584ab5285b51945e0dd523caf77342985ac97ce4 (commit)
      from  a5f7a59bbb86a7cfb7792765270722f07a9a679f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=24e5bff0eb7e82d34775a029296858b8142ff02f
commit 24e5bff0eb7e82d34775a029296858b8142ff02f
Merge: a5f7a59 69fc7bf
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 25 09:52:56 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Oct 25 09:52:56 2016 -0400

    Merge topic 'vs-toolset-options' into next
    
    69fc7bf8 VS: Choose flag map based on the toolset name
    e2ed9a70 VS: Move toolset flag table lookup to global generator
    584ab528 VS: Add internal API to get platform toolset as string


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69fc7bf87db33d88af02602fba811b5c5e740a70
commit 69fc7bf87db33d88af02602fba811b5c5e740a70
Author:     Don Olmstead <don.j.olmstead at gmail.com>
AuthorDate: Mon Oct 17 17:50:34 2016 -0700
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 25 09:46:21 2016 -0400

    VS: Choose flag map based on the toolset name
    
    MSBuild interprets the `.vcxproj` content based on the `PlatformToolset`
    setting, so our reverse mapping needs to be based on that setting too.
    For VS 2010 and above, choose the flag map to match the toolset name
    rather than the generator VS version.
    
    Issue: #16153

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 09c0acf..cf9dbb8 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -680,6 +680,8 @@ if (WIN32)
       cmVisualStudioGeneratorOptions.cxx
       cmVisualStudio10TargetGenerator.h
       cmVisualStudio10TargetGenerator.cxx
+      cmVisualStudio10ToolsetOptions.h
+      cmVisualStudio10ToolsetOptions.cxx
       cmLocalVisualStudio10Generator.cxx
       cmLocalVisualStudio10Generator.h
       cmGlobalVisualStudio10Generator.h
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 6075e2c..7d91740 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -617,25 +617,40 @@ std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion()
 
 cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetClFlagTable() const
 {
-  return this->DefaultClFlagTable;
+  cmIDEFlagTable const* table = this->ToolsetOptions.GetClFlagTable(
+    this->GetPlatformName(), this->GetPlatformToolsetString());
+
+  return (table != CM_NULLPTR) ? table : this->DefaultClFlagTable;
 }
 
 cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetRcFlagTable() const
 {
-  return this->DefaultRcFlagTable;
+  cmIDEFlagTable const* table = this->ToolsetOptions.GetRcFlagTable(
+    this->GetPlatformName(), this->GetPlatformToolsetString());
+
+  return (table != CM_NULLPTR) ? table : this->DefaultRcFlagTable;
 }
 
 cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLibFlagTable() const
 {
-  return this->DefaultLibFlagTable;
+  cmIDEFlagTable const* table = this->ToolsetOptions.GetLibFlagTable(
+    this->GetPlatformName(), this->GetPlatformToolsetString());
+
+  return (table != CM_NULLPTR) ? table : this->DefaultLibFlagTable;
 }
 
 cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLinkFlagTable() const
 {
-  return this->DefaultLinkFlagTable;
+  cmIDEFlagTable const* table = this->ToolsetOptions.GetLinkFlagTable(
+    this->GetPlatformName(), this->GetPlatformToolsetString());
+
+  return (table != CM_NULLPTR) ? table : this->DefaultLinkFlagTable;
 }
 
 cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetMasmFlagTable() const
 {
-  return this->DefaultMasmFlagTable;
+  cmIDEFlagTable const* table = this->ToolsetOptions.GetMasmFlagTable(
+    this->GetPlatformName(), this->GetPlatformToolsetString());
+
+  return (table != CM_NULLPTR) ? table : this->DefaultMasmFlagTable;
 }
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 8418480..4175104 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -4,6 +4,7 @@
 #define cmGlobalVisualStudio10Generator_h
 
 #include "cmGlobalVisualStudio8Generator.h"
+#include "cmVisualStudio10ToolsetOptions.h"
 
 /** \class cmGlobalVisualStudio10Generator
  * \brief Write a Unix makefiles.
@@ -146,6 +147,7 @@ private:
 
   std::string MSBuildCommand;
   bool MSBuildCommandInitialized;
+  cmVisualStudio10ToolsetOptions ToolsetOptions;
   virtual std::string FindMSBuildCommand();
   virtual std::string FindDevEnvCommand();
   virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
diff --git a/Source/cmVisualStudio10ToolsetOptions.cxx b/Source/cmVisualStudio10ToolsetOptions.cxx
new file mode 100644
index 0000000..b928f43
--- /dev/null
+++ b/Source/cmVisualStudio10ToolsetOptions.cxx
@@ -0,0 +1,134 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
+#include "cmVisualStudio10ToolsetOptions.h"
+
+#include "cmAlgorithms.h"
+#include "cmIDEFlagTable.h"
+#include "cmVisualStudioGeneratorOptions.h"
+
+#include "cmVS10CLFlagTable.h"
+#include "cmVS10LibFlagTable.h"
+#include "cmVS10LinkFlagTable.h"
+#include "cmVS10MASMFlagTable.h"
+#include "cmVS10RCFlagTable.h"
+#include "cmVS11CLFlagTable.h"
+#include "cmVS11LibFlagTable.h"
+#include "cmVS11LinkFlagTable.h"
+#include "cmVS11MASMFlagTable.h"
+#include "cmVS11RCFlagTable.h"
+#include "cmVS12CLFlagTable.h"
+#include "cmVS12LibFlagTable.h"
+#include "cmVS12LinkFlagTable.h"
+#include "cmVS12MASMFlagTable.h"
+#include "cmVS12RCFlagTable.h"
+#include "cmVS140CLFlagTable.h"
+#include "cmVS141CLFlagTable.h"
+#include "cmVS14LibFlagTable.h"
+#include "cmVS14LinkFlagTable.h"
+#include "cmVS14MASMFlagTable.h"
+#include "cmVS14RCFlagTable.h"
+
+cmIDEFlagTable const* cmVisualStudio10ToolsetOptions::GetClFlagTable(
+  std::string const& name, std::string const& toolset) const
+{
+  std::string const useToolset = this->GetToolsetName(name, toolset);
+
+  if (toolset == "v141") {
+    return cmVS141CLFlagTable;
+  } else if (useToolset == "v140") {
+    return cmVS140CLFlagTable;
+  } else if (useToolset == "v120") {
+    return cmVS12CLFlagTable;
+  } else if (useToolset == "v110") {
+    return cmVS11CLFlagTable;
+  } else if (useToolset == "v100") {
+    return cmVS10CLFlagTable;
+  } else {
+    return 0;
+  }
+}
+
+cmIDEFlagTable const* cmVisualStudio10ToolsetOptions::GetRcFlagTable(
+  std::string const& name, std::string const& toolset) const
+{
+  std::string const useToolset = this->GetToolsetName(name, toolset);
+
+  if ((useToolset == "v140") || (useToolset == "v141")) {
+    return cmVS14RCFlagTable;
+  } else if (useToolset == "v120") {
+    return cmVS12RCFlagTable;
+  } else if (useToolset == "v110") {
+    return cmVS11RCFlagTable;
+  } else if (useToolset == "v100") {
+    return cmVS10RCFlagTable;
+  } else {
+    return 0;
+  }
+}
+
+cmIDEFlagTable const* cmVisualStudio10ToolsetOptions::GetLibFlagTable(
+  std::string const& name, std::string const& toolset) const
+{
+  std::string const useToolset = this->GetToolsetName(name, toolset);
+
+  if ((useToolset == "v140") || (useToolset == "v141")) {
+    return cmVS14LibFlagTable;
+  } else if (useToolset == "v120") {
+    return cmVS12LibFlagTable;
+  } else if (useToolset == "v110") {
+    return cmVS11LibFlagTable;
+  } else if (useToolset == "v100") {
+    return cmVS10LibFlagTable;
+  } else {
+    return 0;
+  }
+}
+
+cmIDEFlagTable const* cmVisualStudio10ToolsetOptions::GetLinkFlagTable(
+  std::string const& name, std::string const& toolset) const
+{
+  std::string const useToolset = this->GetToolsetName(name, toolset);
+
+  if ((useToolset == "v140") || (useToolset == "v141")) {
+    return cmVS14LinkFlagTable;
+  } else if (useToolset == "v120") {
+    return cmVS12LinkFlagTable;
+  } else if (useToolset == "v110") {
+    return cmVS11LinkFlagTable;
+  } else if (useToolset == "v100") {
+    return cmVS10LinkFlagTable;
+  } else {
+    return 0;
+  }
+}
+
+cmIDEFlagTable const* cmVisualStudio10ToolsetOptions::GetMasmFlagTable(
+  std::string const& name, std::string const& toolset) const
+{
+  std::string const useToolset = this->GetToolsetName(name, toolset);
+
+  if ((useToolset == "v140") || (useToolset == "v141")) {
+    return cmVS14MASMFlagTable;
+  } else if (useToolset == "v120") {
+    return cmVS12MASMFlagTable;
+  } else if (useToolset == "v110") {
+    return cmVS11MASMFlagTable;
+  } else if (useToolset == "v100") {
+    return cmVS10MASMFlagTable;
+  } else {
+    return 0;
+  }
+}
+
+std::string cmVisualStudio10ToolsetOptions::GetToolsetName(
+  std::string const& name, std::string const& toolset) const
+{
+  static_cast<void>(name);
+  std::size_t length = toolset.length();
+
+  if (cmHasLiteralSuffix(toolset, "_xp")) {
+    length -= 3;
+  }
+
+  return toolset.substr(0, length);
+}
diff --git a/Source/cmVisualStudio10ToolsetOptions.h b/Source/cmVisualStudio10ToolsetOptions.h
new file mode 100644
index 0000000..ea6c9c8
--- /dev/null
+++ b/Source/cmVisualStudio10ToolsetOptions.h
@@ -0,0 +1,33 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
+#ifndef cmVisualStudio10ToolsetOptions_h
+#define cmVisualStudio10ToolsetOptions_h
+
+#include "cmStandardIncludes.h"
+
+struct cmIDEFlagTable;
+
+/** \class cmVisualStudio10ToolsetOptions
+ * \brief Retrieves toolset options for MSBuild.
+ *
+ * cmVisualStudio10ToolsetOptions manages toolsets within MSBuild
+ */
+class cmVisualStudio10ToolsetOptions
+{
+public:
+  cmIDEFlagTable const* GetClFlagTable(std::string const& name,
+                                       std::string const& toolset) const;
+  cmIDEFlagTable const* GetRcFlagTable(std::string const& name,
+                                       std::string const& toolset) const;
+  cmIDEFlagTable const* GetLibFlagTable(std::string const& name,
+                                        std::string const& toolset) const;
+  cmIDEFlagTable const* GetLinkFlagTable(std::string const& name,
+                                         std::string const& toolset) const;
+  cmIDEFlagTable const* GetMasmFlagTable(std::string const& name,
+                                         std::string const& toolset) const;
+
+private:
+  std::string GetToolsetName(std::string const& name,
+                             std::string const& toolset) const;
+};
+#endif

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e2ed9a70929092ab7b32e036886859e53fbff897
commit e2ed9a70929092ab7b32e036886859e53fbff897
Author:     Don Olmstead <don.j.olmstead at gmail.com>
AuthorDate: Mon Oct 17 17:50:34 2016 -0700
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 25 09:19:49 2016 -0400

    VS: Move toolset flag table lookup to global generator
    
    Move `Get*FlagTable` methods to the global generator and have each VS
    generator version pre-populate its default flag table.

diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 793c605..6075e2c 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -9,6 +9,11 @@
 #include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
+#include "cmVS10CLFlagTable.h"
+#include "cmVS10LibFlagTable.h"
+#include "cmVS10LinkFlagTable.h"
+#include "cmVS10MASMFlagTable.h"
+#include "cmVS10RCFlagTable.h"
 #include "cmVisualStudioSlnData.h"
 #include "cmVisualStudioSlnParser.h"
 #include "cmake.h"
@@ -94,6 +99,11 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
   this->SystemIsWindowsStore = false;
   this->MSBuildCommandInitialized = false;
   this->DefaultPlatformToolset = "v100";
+  this->DefaultClFlagTable = cmVS10CLFlagTable;
+  this->DefaultLibFlagTable = cmVS10LibFlagTable;
+  this->DefaultLinkFlagTable = cmVS10LinkFlagTable;
+  this->DefaultMasmFlagTable = cmVS10MASMFlagTable;
+  this->DefaultRcFlagTable = cmVS10RCFlagTable;
   this->Version = VS10;
 }
 
@@ -604,3 +614,28 @@ std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion()
     version, cmSystemTools::KeyWOW64_32);
   return version;
 }
+
+cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetClFlagTable() const
+{
+  return this->DefaultClFlagTable;
+}
+
+cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetRcFlagTable() const
+{
+  return this->DefaultRcFlagTable;
+}
+
+cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLibFlagTable() const
+{
+  return this->DefaultLibFlagTable;
+}
+
+cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLinkFlagTable() const
+{
+  return this->DefaultLinkFlagTable;
+}
+
+cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetMasmFlagTable() const
+{
+  return this->DefaultMasmFlagTable;
+}
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index ba07a5b..8418480 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -89,6 +89,12 @@ public:
 
   static std::string GetInstalledNsightTegraVersion();
 
+  cmIDEFlagTable const* GetClFlagTable() const;
+  cmIDEFlagTable const* GetRcFlagTable() const;
+  cmIDEFlagTable const* GetLibFlagTable() const;
+  cmIDEFlagTable const* GetLinkFlagTable() const;
+  cmIDEFlagTable const* GetMasmFlagTable() const;
+
 protected:
   virtual void Generate();
   virtual bool InitializeSystem(cmMakefile* mf);
@@ -112,6 +118,11 @@ protected:
   std::string SystemName;
   std::string SystemVersion;
   std::string NsightTegraVersion;
+  cmIDEFlagTable const* DefaultClFlagTable;
+  cmIDEFlagTable const* DefaultLibFlagTable;
+  cmIDEFlagTable const* DefaultLinkFlagTable;
+  cmIDEFlagTable const* DefaultMasmFlagTable;
+  cmIDEFlagTable const* DefaultRcFlagTable;
   bool SystemIsWindowsCE;
   bool SystemIsWindowsPhone;
   bool SystemIsWindowsStore;
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index f120762..acd2c2b 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -5,6 +5,11 @@
 #include "cmAlgorithms.h"
 #include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
+#include "cmVS11CLFlagTable.h"
+#include "cmVS11LibFlagTable.h"
+#include "cmVS11LinkFlagTable.h"
+#include "cmVS11MASMFlagTable.h"
+#include "cmVS11RCFlagTable.h"
 
 static const char vs11generatorName[] = "Visual Studio 11 2012";
 
@@ -101,6 +106,11 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
     "ProductDir",
     vc11Express, cmSystemTools::KeyWOW64_32);
   this->DefaultPlatformToolset = "v110";
+  this->DefaultClFlagTable = cmVS11CLFlagTable;
+  this->DefaultLibFlagTable = cmVS11LibFlagTable;
+  this->DefaultLinkFlagTable = cmVS11LinkFlagTable;
+  this->DefaultMasmFlagTable = cmVS11MASMFlagTable;
+  this->DefaultRcFlagTable = cmVS11RCFlagTable;
   this->Version = VS11;
 }
 
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index ec7916c..c18ff9e 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -5,6 +5,11 @@
 #include "cmAlgorithms.h"
 #include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
+#include "cmVS12CLFlagTable.h"
+#include "cmVS12LibFlagTable.h"
+#include "cmVS12LinkFlagTable.h"
+#include "cmVS12MASMFlagTable.h"
+#include "cmVS12RCFlagTable.h"
 
 static const char vs12generatorName[] = "Visual Studio 12 2013";
 
@@ -83,6 +88,11 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
     "ProductDir",
     vc12Express, cmSystemTools::KeyWOW64_32);
   this->DefaultPlatformToolset = "v120";
+  this->DefaultClFlagTable = cmVS12CLFlagTable;
+  this->DefaultLibFlagTable = cmVS12LibFlagTable;
+  this->DefaultLinkFlagTable = cmVS12LinkFlagTable;
+  this->DefaultMasmFlagTable = cmVS12MASMFlagTable;
+  this->DefaultRcFlagTable = cmVS12RCFlagTable;
   this->Version = VS12;
 }
 
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 586fe3c..e0b86d7 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -5,6 +5,11 @@
 #include "cmAlgorithms.h"
 #include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
+#include "cmVS140CLFlagTable.h"
+#include "cmVS14LibFlagTable.h"
+#include "cmVS14LinkFlagTable.h"
+#include "cmVS14MASMFlagTable.h"
+#include "cmVS14RCFlagTable.h"
 
 static const char vs14generatorName[] = "Visual Studio 14 2015";
 
@@ -83,6 +88,11 @@ cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(
     "ProductDir",
     vc14Express, cmSystemTools::KeyWOW64_32);
   this->DefaultPlatformToolset = "v140";
+  this->DefaultClFlagTable = cmVS140CLFlagTable;
+  this->DefaultLibFlagTable = cmVS14LibFlagTable;
+  this->DefaultLinkFlagTable = cmVS14LinkFlagTable;
+  this->DefaultMasmFlagTable = cmVS14MASMFlagTable;
+  this->DefaultRcFlagTable = cmVS14RCFlagTable;
   this->Version = VS14;
 }
 
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx
index a833a5f..fbc7a10 100644
--- a/Source/cmGlobalVisualStudio15Generator.cxx
+++ b/Source/cmGlobalVisualStudio15Generator.cxx
@@ -5,6 +5,7 @@
 #include "cmAlgorithms.h"
 #include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
+#include "cmVS141CLFlagTable.h"
 
 static const char vs15generatorName[] = "Visual Studio 15";
 
@@ -80,6 +81,7 @@ cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator(
     "ProductDir",
     vc15Express, cmSystemTools::KeyWOW64_32);
   this->DefaultPlatformToolset = "v141";
+  this->DefaultClFlagTable = cmVS141CLFlagTable;
   this->Version = VS15;
 }
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 9c857f2..22167ca 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -10,27 +10,6 @@
 #include "cmLocalVisualStudio7Generator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
-#include "cmVS10CLFlagTable.h"
-#include "cmVS10LibFlagTable.h"
-#include "cmVS10LinkFlagTable.h"
-#include "cmVS10MASMFlagTable.h"
-#include "cmVS10RCFlagTable.h"
-#include "cmVS11CLFlagTable.h"
-#include "cmVS11LibFlagTable.h"
-#include "cmVS11LinkFlagTable.h"
-#include "cmVS11MASMFlagTable.h"
-#include "cmVS11RCFlagTable.h"
-#include "cmVS12CLFlagTable.h"
-#include "cmVS12LibFlagTable.h"
-#include "cmVS12LinkFlagTable.h"
-#include "cmVS12MASMFlagTable.h"
-#include "cmVS12RCFlagTable.h"
-#include "cmVS140CLFlagTable.h"
-#include "cmVS141CLFlagTable.h"
-#include "cmVS14LibFlagTable.h"
-#include "cmVS14LinkFlagTable.h"
-#include "cmVS14MASMFlagTable.h"
-#include "cmVS14RCFlagTable.h"
 #include "cmVisualStudioGeneratorOptions.h"
 #include "windows.h"
 
@@ -38,102 +17,6 @@
 
 static std::string const kWINDOWS_7_1_SDK = "Windows7.1SDK";
 
-cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const
-{
-  if (this->MSTools) {
-    cmGlobalVisualStudioGenerator::VSVersion v =
-      this->LocalGenerator->GetVersion();
-    if (v >= cmGlobalVisualStudioGenerator::VS14) {
-      // FIXME: All flag table selection should be based on the toolset name.
-      // See issue #16153.  For now, treat VS 15's toolset as a special case.
-      const char* toolset = this->GlobalGenerator->GetPlatformToolset();
-      if (toolset && cmHasLiteralPrefix(toolset, "v141")) {
-        return cmVS141CLFlagTable;
-      }
-      return cmVS140CLFlagTable;
-    } else if (v >= cmGlobalVisualStudioGenerator::VS12) {
-      return cmVS12CLFlagTable;
-    } else if (v == cmGlobalVisualStudioGenerator::VS11) {
-      return cmVS11CLFlagTable;
-    } else {
-      return cmVS10CLFlagTable;
-    }
-  }
-  return 0;
-}
-
-cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetRcFlagTable() const
-{
-  if (this->MSTools) {
-    cmGlobalVisualStudioGenerator::VSVersion v =
-      this->LocalGenerator->GetVersion();
-    if (v >= cmGlobalVisualStudioGenerator::VS14) {
-      return cmVS14RCFlagTable;
-    } else if (v >= cmGlobalVisualStudioGenerator::VS12) {
-      return cmVS12RCFlagTable;
-    } else if (v == cmGlobalVisualStudioGenerator::VS11) {
-      return cmVS11RCFlagTable;
-    } else {
-      return cmVS10RCFlagTable;
-    }
-  }
-  return 0;
-}
-
-cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const
-{
-  if (this->MSTools) {
-    cmGlobalVisualStudioGenerator::VSVersion v =
-      this->LocalGenerator->GetVersion();
-    if (v >= cmGlobalVisualStudioGenerator::VS14) {
-      return cmVS14LibFlagTable;
-    } else if (v >= cmGlobalVisualStudioGenerator::VS12) {
-      return cmVS12LibFlagTable;
-    } else if (v == cmGlobalVisualStudioGenerator::VS11) {
-      return cmVS11LibFlagTable;
-    } else {
-      return cmVS10LibFlagTable;
-    }
-  }
-  return 0;
-}
-
-cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const
-{
-  if (this->MSTools) {
-    cmGlobalVisualStudioGenerator::VSVersion v =
-      this->LocalGenerator->GetVersion();
-    if (v >= cmGlobalVisualStudioGenerator::VS14) {
-      return cmVS14LinkFlagTable;
-    } else if (v >= cmGlobalVisualStudioGenerator::VS12) {
-      return cmVS12LinkFlagTable;
-    } else if (v == cmGlobalVisualStudioGenerator::VS11) {
-      return cmVS11LinkFlagTable;
-    } else {
-      return cmVS10LinkFlagTable;
-    }
-  }
-  return 0;
-}
-
-cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetMasmFlagTable() const
-{
-  if (this->MSTools) {
-    cmGlobalVisualStudioGenerator::VSVersion v =
-      this->LocalGenerator->GetVersion();
-    if (v >= cmGlobalVisualStudioGenerator::VS14) {
-      return cmVS14MASMFlagTable;
-    } else if (v >= cmGlobalVisualStudioGenerator::VS12) {
-      return cmVS12MASMFlagTable;
-    } else if (v == cmGlobalVisualStudioGenerator::VS11) {
-      return cmVS11MASMFlagTable;
-    } else {
-      return cmVS10MASMFlagTable;
-    }
-  }
-  return 0;
-}
-
 static std::string cmVS10EscapeXML(std::string arg)
 {
   cmSystemTools::ReplaceString(arg, "&", "&");
@@ -1533,9 +1416,11 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
       (*this->BuildFileStream) << firstString;
       firstString = ""; // only do firstString once
       hasFlags = true;
+      cmGlobalVisualStudio10Generator* gg =
+        static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
       cmVisualStudioGeneratorOptions clOptions(
         this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler,
-        this->GetClFlagTable(), 0, this);
+        gg->GetClFlagTable(), 0, this);
       if (compileAs) {
         clOptions.AddFlag("CompileAs", compileAs);
       }
@@ -1696,8 +1581,10 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
   // copied from cmLocalVisualStudio7Generator.cxx 805
   // TODO: Integrate code below with cmLocalVisualStudio7Generator.
 
+  cmGlobalVisualStudio10Generator* gg =
+    static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
   CM_AUTO_PTR<Options> pOptions(new Options(
-    this->LocalGenerator, Options::Compiler, this->GetClFlagTable()));
+    this->LocalGenerator, Options::Compiler, gg->GetClFlagTable()));
   Options& clOptions = *pOptions;
 
   std::string flags;
@@ -1861,8 +1748,10 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions()
 bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
   std::string const& configName)
 {
+  cmGlobalVisualStudio10Generator* gg =
+    static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
   CM_AUTO_PTR<Options> pOptions(new Options(
-    this->LocalGenerator, Options::ResourceCompiler, this->GetRcFlagTable()));
+    this->LocalGenerator, Options::ResourceCompiler, gg->GetRcFlagTable()));
   Options& rcOptions = *pOptions;
 
   std::string CONFIG = cmSystemTools::UpperCase(configName);
@@ -1918,8 +1807,10 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions()
 bool cmVisualStudio10TargetGenerator::ComputeMasmOptions(
   std::string const& configName)
 {
+  cmGlobalVisualStudio10Generator* gg =
+    static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
   CM_AUTO_PTR<Options> pOptions(new Options(
-    this->LocalGenerator, Options::MasmCompiler, this->GetMasmFlagTable()));
+    this->LocalGenerator, Options::MasmCompiler, gg->GetMasmFlagTable()));
   Options& masmOptions = *pOptions;
 
   std::string CONFIG = cmSystemTools::UpperCase(configName);
@@ -1968,9 +1859,11 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions(
     libflags, cmSystemTools::UpperCase(config), this->GeneratorTarget);
   if (!libflags.empty()) {
     this->WriteString("<Lib>\n", 2);
+    cmGlobalVisualStudio10Generator* gg =
+      static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
     cmVisualStudioGeneratorOptions libOptions(
       this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker,
-      this->GetLibFlagTable(), 0, this);
+      gg->GetLibFlagTable(), 0, this);
     libOptions.Parse(libflags.c_str());
     libOptions.OutputAdditionalOptions(*this->BuildFileStream, "      ", "");
     libOptions.OutputFlagMap(*this->BuildFileStream, "      ");
@@ -2163,8 +2056,10 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions()
 bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
   std::string const& config)
 {
+  cmGlobalVisualStudio10Generator* gg =
+    static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
   CM_AUTO_PTR<Options> pOptions(new Options(
-    this->LocalGenerator, Options::Linker, this->GetLinkFlagTable(), 0, this));
+    this->LocalGenerator, Options::Linker, gg->GetLinkFlagTable(), 0, this));
   Options& linkOptions = *pOptions;
 
   const std::string& linkLanguage =
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index c62be7e..54b9569 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -121,12 +121,6 @@ private:
   bool IsXamlHeader(const std::string& headerFile);
   bool IsXamlSource(const std::string& headerFile);
 
-  cmIDEFlagTable const* GetClFlagTable() const;
-  cmIDEFlagTable const* GetRcFlagTable() const;
-  cmIDEFlagTable const* GetLibFlagTable() const;
-  cmIDEFlagTable const* GetLinkFlagTable() const;
-  cmIDEFlagTable const* GetMasmFlagTable() const;
-
   bool ForceOld(const std::string& source) const;
 
 private:

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=584ab5285b51945e0dd523caf77342985ac97ce4
commit 584ab5285b51945e0dd523caf77342985ac97ce4
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 18 10:09:57 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 25 09:19:49 2016 -0400

    VS: Add internal API to get platform toolset as string

diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 7af971e..793c605 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -339,13 +339,20 @@ void cmGlobalVisualStudio10Generator::EnableLanguage(
 
 const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const
 {
+  return this->GetPlatformToolsetString().c_str();
+}
+
+std::string const& cmGlobalVisualStudio10Generator::GetPlatformToolsetString()
+  const
+{
   if (!this->GeneratorToolset.empty()) {
-    return this->GeneratorToolset.c_str();
+    return this->GeneratorToolset;
   }
   if (!this->DefaultPlatformToolset.empty()) {
-    return this->DefaultPlatformToolset.c_str();
+    return this->DefaultPlatformToolset;
   }
-  return 0;
+  static std::string const empty;
+  return empty;
 }
 
 const char*
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 62b8661..ba07a5b 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -48,6 +48,7 @@ public:
 
   /** The toolset name for the target platform.  */
   const char* GetPlatformToolset() const;
+  std::string const& GetPlatformToolsetString() const;
 
   /** The toolset host architecture name (e.g. x64 for 64-bit host tools).  */
   const char* GetPlatformToolsetHostArchitecture() const;

-----------------------------------------------------------------------

Summary of changes:
 Source/CMakeLists.txt                      |    2 +
 Source/cmGlobalVisualStudio10Generator.cxx |   63 ++++++++++++-
 Source/cmGlobalVisualStudio10Generator.h   |   14 +++
 Source/cmGlobalVisualStudio11Generator.cxx |   10 ++
 Source/cmGlobalVisualStudio12Generator.cxx |   10 ++
 Source/cmGlobalVisualStudio14Generator.cxx |   10 ++
 Source/cmGlobalVisualStudio15Generator.cxx |    2 +
 Source/cmVisualStudio10TargetGenerator.cxx |  141 ++++------------------------
 Source/cmVisualStudio10TargetGenerator.h   |    6 --
 Source/cmVisualStudio10ToolsetOptions.cxx  |  134 ++++++++++++++++++++++++++
 Source/cmVisualStudio10ToolsetOptions.h    |   33 +++++++
 11 files changed, 293 insertions(+), 132 deletions(-)
 create mode 100644 Source/cmVisualStudio10ToolsetOptions.cxx
 create mode 100644 Source/cmVisualStudio10ToolsetOptions.h


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list