From ec3a31f42090702cbf1c9d9e2cbf6524ad1d5781 Mon Sep 17 00:00:00 2001
From: Modestas Vainius <modax@debian.org>
Date: Thu, 4 Jul 2013 23:25:18 +0300
Subject: [PATCH] Imported Upstream version 2.8.11.2

---
 ChangeLog.manual                              |  18 +
 Modules/CMakeDetermineASM-ATTCompiler.cmake   |   2 +-
 Modules/CMakeDetermineASMCompiler.cmake       |   4 +-
 Modules/CMakeDetermineASM_NASMCompiler.cmake  |   2 +-
 Modules/CMakeVS12FindMake.cmake               |  27 ++
 Modules/FindBoost.cmake                       |   2 +
 Modules/InstallRequiredSystemLibraries.cmake  |   8 +
 Modules/Platform/Windows-MSVC.cmake           |   5 +-
 Modules/SelectLibraryConfigurations.cmake     |   2 +-
 Source/CMakeLists.txt                         |   2 +
 Source/CMakeVersion.cmake                     |   2 +-
 Source/cmCryptoHash.cxx                       |   6 +-
 Source/cmDocumentVariables.cxx                |   3 +-
 Source/cmGlobalVisualStudio10Generator.cxx    |   2 +-
 Source/cmGlobalVisualStudio11Generator.cxx    |   2 +-
 Source/cmGlobalVisualStudio12Generator.cxx    | 111 ++++++
 Source/cmGlobalVisualStudio12Generator.h      |  40 ++
 Source/cmLocalVisualStudioGenerator.h         |   3 +-
 Source/cmVS12CLFlagTable.h                    | 297 +++++++++++++++
 Source/cmVS12LibFlagTable.h                   | 102 ++++++
 Source/cmVS12LinkFlagTable.h                  | 343 ++++++++++++++++++
 Source/cmVisualStudio10TargetGenerator.cxx    |  24 +-
 Source/cmVisualStudioGeneratorOptions.cxx     |   1 +
 Source/cmake.cxx                              |   4 +
 Source/cmparseMSBuildXML.py                   |   3 +
 .../CMakeLists.txt                            |   4 +
 Tests/Preprocess/CMakeLists.txt               |   6 +-
 .../GeneratorToolset/RunCMakeTest.cmake       |   2 +-
 Tests/VSExternalInclude/CMakeLists.txt        |   4 +-
 Utilities/cmcurl/CMakeLists.txt               |   2 -
 Utilities/cmcurl/Platforms/WindowsCache.cmake |   1 -
 Utilities/cmcurl/Platforms/config-aix.h       |   3 -
 Utilities/cmcurl/config.h.in                  |   3 -
 Utilities/cmcurl/socks.c                      |  11 +-
 Utilities/cmcurl/strequal.c                   |  42 ---
 Utilities/cmcurl/strequal.h                   |   5 -
 36 files changed, 1016 insertions(+), 82 deletions(-)
 create mode 100644 Modules/CMakeVS12FindMake.cmake
 create mode 100644 Source/cmGlobalVisualStudio12Generator.cxx
 create mode 100644 Source/cmGlobalVisualStudio12Generator.h
 create mode 100644 Source/cmVS12CLFlagTable.h
 create mode 100644 Source/cmVS12LibFlagTable.h
 create mode 100644 Source/cmVS12LinkFlagTable.h

diff --git a/ChangeLog.manual b/ChangeLog.manual
index ff3074d00..134b4aa17 100644
--- a/ChangeLog.manual
+++ b/ChangeLog.manual
@@ -1,3 +1,21 @@
+Changes in CMake 2.8.11.2 (since 2.8.11.1)
+------------------------------------------
+Alex Neundorf (1):
+      asm support: adapt to changes in CMakeDetectCompiler in 2.8.10
+
+Bjoern Thiel (1):
+      SelectLibraryConfigurations: Fix for cached <base>_LIBRARY
+
+Brad King (5):
+      cmCryptoHash: Increase alignment of HashFile buffer
+      cmcurl: Backport curl bug 1192 fix (#14250)
+      VS12: Add Visual Studio 12 generator (#14251)
+      VS12: Generate flag tables from MSBuild v120 tool files
+      FindBoost: Add -vc120 mangling for VS 12
+
+Robert Maynard (1):
+      VS: Clarify Visual Studio product year for each version
+
 Changes in CMake 2.8.11.1 (since 2.8.11)
 ----------------------------------------
 Brad King (5):
diff --git a/Modules/CMakeDetermineASM-ATTCompiler.cmake b/Modules/CMakeDetermineASM-ATTCompiler.cmake
index cec09e985..03c566810 100644
--- a/Modules/CMakeDetermineASM-ATTCompiler.cmake
+++ b/Modules/CMakeDetermineASM-ATTCompiler.cmake
@@ -15,6 +15,6 @@
 # determine the compiler to use for ASM using AT&T syntax, e.g. GNU as
 
 set(ASM_DIALECT "-ATT")
-set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}gas ${_CMAKE_TOOLCHAIN_PREFIX}as)
+set(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gas ${_CMAKE_TOOLCHAIN_PREFIX}as)
 include(CMakeDetermineASMCompiler)
 set(ASM_DIALECT)
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index 9999f62ab..99b04e39b 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -39,8 +39,8 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
       endif()
     endif()
   else() # some specific assembler "dialect"
-    if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
-      message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !")
+    if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT  AND NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST)
+      message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT or CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST must be preset !")
     endif()
   endif()
 
diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake
index 50f71dd8c..5d783b155 100644
--- a/Modules/CMakeDetermineASM_NASMCompiler.cmake
+++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake
@@ -14,7 +14,7 @@
 
 # Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible
 
-set(CMAKE_ASM_NASM_COMPILER_INIT nasm yasm)
+set(CMAKE_ASM_NASM_COMPILER_LIST nasm yasm)
 
 if(NOT CMAKE_ASM_NASM_COMPILER)
   find_program(CMAKE_ASM_NASM_COMPILER nasm
diff --git a/Modules/CMakeVS12FindMake.cmake b/Modules/CMakeVS12FindMake.cmake
new file mode 100644
index 000000000..338d9a236
--- /dev/null
+++ b/Modules/CMakeVS12FindMake.cmake
@@ -0,0 +1,27 @@
+
+#=============================================================================
+# Copyright 2007-2013 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# Always use MSBuild because:
+# - devenv treats command-line builds as recently-loaded projects in the IDE
+# - devenv does not appear to support non-standard platform toolsets
+# If we need devenv for Intel Fortran in the future we should add
+# a special case when Fortran is enabled.
+find_program(CMAKE_MAKE_PROGRAM
+  NAMES MSBuild
+  HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\12.0;MSBuildToolsPath]"
+  )
+
+mark_as_advanced(CMAKE_MAKE_PROGRAM)
+set(MSVC12 1)
+set(MSVC_VERSION 1800)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 0a9ffc15f..f2c2ce37f 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -349,6 +349,8 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
     else()
       set (_boost_COMPILER "-il")
     endif()
+  elseif (MSVC12)
+    set(_boost_COMPILER "-vc120")
   elseif (MSVC11)
     set(_boost_COMPILER "-vc110")
   elseif (MSVC10)
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index bd9750185..2479d68b5 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -182,6 +182,10 @@ if(MSVC)
     MSVCRT_FILES_FOR_VERSION(11)
   endif()
 
+  if(MSVC12)
+    MSVCRT_FILES_FOR_VERSION(12)
+  endif()
+
   if(CMAKE_INSTALL_MFC_LIBRARIES)
     if(MSVC70)
       set(__install__libs ${__install__libs}
@@ -330,6 +334,10 @@ if(MSVC)
     if(MSVC11)
       MFC_FILES_FOR_VERSION(11)
     endif()
+
+    if(MSVC12)
+      MFC_FILES_FOR_VERSION(12)
+    endif()
   endif()
 
   foreach(lib
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index f9df6d8a6..e03b60115 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -81,6 +81,7 @@ if(NOT MSVC_VERSION)
 
   set(MSVC10)
   set(MSVC11)
+  set(MSVC12)
   set(MSVC60)
   set(MSVC70)
   set(MSVC71)
@@ -88,7 +89,9 @@ if(NOT MSVC_VERSION)
   set(MSVC90)
   set(CMAKE_COMPILER_2005)
   set(CMAKE_COMPILER_SUPPORTS_PDBTYPE)
-  if(NOT "${_compiler_version}" VERSION_LESS 17)
+  if(NOT "${_compiler_version}" VERSION_LESS 18)
+    set(MSVC12 1)
+  elseif(NOT "${_compiler_version}" VERSION_LESS 17)
     set(MSVC11 1)
   elseif(NOT  "${_compiler_version}" VERSION_LESS 16)
     set(MSVC10 1)
diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake
index 62137bb28..5bca064f5 100644
--- a/Modules/SelectLibraryConfigurations.cmake
+++ b/Modules/SelectLibraryConfigurations.cmake
@@ -62,7 +62,7 @@ macro( select_library_configurations basename )
         # if the generator supports configuration types or CMAKE_BUILD_TYPE
         # is set, then set optimized and debug options.
         if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
-            set( ${basename}_LIBRARY )
+            set( ${basename}_LIBRARY "" )
             foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
                 list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
             endforeach()
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ab62d2b35..f0519fe7c 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -345,6 +345,8 @@ if (WIN32)
       cmGlobalVisualStudio10Generator.cxx
       cmGlobalVisualStudio11Generator.h
       cmGlobalVisualStudio11Generator.cxx
+      cmGlobalVisualStudio12Generator.h
+      cmGlobalVisualStudio12Generator.cxx
       cmGlobalVisualStudioGenerator.cxx
       cmGlobalVisualStudioGenerator.h
       cmGlobalWatcomWMakeGenerator.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 34946af4c..a8b890775 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
 set(CMake_VERSION_MAJOR 2)
 set(CMake_VERSION_MINOR 8)
 set(CMake_VERSION_PATCH 11)
-set(CMake_VERSION_TWEAK 1)
+set(CMake_VERSION_TWEAK 2)
 #set(CMake_VERSION_RC 0)
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index a1505bd65..a4f6ac4b4 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -54,8 +54,8 @@ std::string cmCryptoHash::HashFile(const char* file)
   this->Initialize();
 
   // Should be efficient enough on most system:
-  const int bufferSize = 4096;
-  char buffer[bufferSize];
+  cm_sha2_uint64_t buffer[512];
+  char* buffer_c = reinterpret_cast<char*>(buffer);
   unsigned char const* buffer_uc =
     reinterpret_cast<unsigned char const*>(buffer);
   // This copy loop is very sensitive on certain platforms with
@@ -65,7 +65,7 @@ std::string cmCryptoHash::HashFile(const char* file)
   // error occurred.  Therefore, the loop should be safe everywhere.
   while(fin)
     {
-    fin.read(buffer, bufferSize);
+    fin.read(buffer_c, sizeof(buffer));
     if(int gcount = static_cast<int>(fin.gcount()))
       {
       this->Append(buffer_uc, gcount);
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 50509a0b3..61f9f5a25 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -1022,7 +1022,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
      false,
      "Variables That Describe the System");
 
-  int msvc_versions[] = { 60, 70, 71, 80, 90, 100, 110, 0 };
+  int msvc_versions[] = { 60, 70, 71, 80, 90, 100, 110, 120, 0 };
   for (int i = 0; msvc_versions[i] != 0; i ++)
     {
     const char minor = (char)('0' + (msvc_versions[i] % 10));
@@ -1069,6 +1069,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
      "  1500 = VS  9.0\n"
      "  1600 = VS 10.0\n"
      "  1700 = VS 11.0\n"
+     "  1800 = VS 12.0\n"
      "",
      false,
      "Variables That Describe the System");
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index b8c493916..ee7c56fc6 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -45,7 +45,7 @@ public:
 
   virtual void GetDocumentation(cmDocumentationEntry& entry) const {
     entry.Name = "Visual Studio 10";
-    entry.Brief = "Generates Visual Studio 10 project files.";
+    entry.Brief = "Generates Visual Studio 10 (2010) project files.";
     entry.Full =
       "It is possible to append a space followed by the platform name "
       "to create project files for a specific target platform. E.g. "
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 299aaa8b9..624d01d69 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -42,7 +42,7 @@ public:
 
   virtual void GetDocumentation(cmDocumentationEntry& entry) const {
     entry.Name = "Visual Studio 11";
-    entry.Brief = "Generates Visual Studio 11 project files.";
+    entry.Brief = "Generates Visual Studio 11 (2012) project files.";
     entry.Full =
       "It is possible to append a space followed by the platform name "
       "to create project files for a specific target platform. E.g. "
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
new file mode 100644
index 000000000..d77b84d2c
--- /dev/null
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -0,0 +1,111 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+#include "cmGlobalVisualStudio12Generator.h"
+#include "cmLocalVisualStudio10Generator.h"
+#include "cmMakefile.h"
+
+static const char vs12Win32generatorName[] = "Visual Studio 12";
+static const char vs12Win64generatorName[] = "Visual Studio 12 Win64";
+static const char vs12ARMgeneratorName[] = "Visual Studio 12 ARM";
+
+class cmGlobalVisualStudio12Generator::Factory
+  : public cmGlobalGeneratorFactory
+{
+public:
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
+    if(!strcmp(name, vs12Win32generatorName))
+      {
+      return new cmGlobalVisualStudio12Generator(
+        vs12Win32generatorName, NULL, NULL);
+      }
+    if(!strcmp(name, vs12Win64generatorName))
+      {
+      return new cmGlobalVisualStudio12Generator(
+        vs12Win64generatorName, "x64", "CMAKE_FORCE_WIN64");
+      }
+    if(!strcmp(name, vs12ARMgeneratorName))
+      {
+      return new cmGlobalVisualStudio12Generator(
+        vs12ARMgeneratorName, "ARM", NULL);
+      }
+    return 0;
+  }
+
+  virtual void GetDocumentation(cmDocumentationEntry& entry) const {
+    entry.Name = "Visual Studio 12";
+    entry.Brief = "Generates Visual Studio 12 (2013) project files.";
+    entry.Full =
+      "It is possible to append a space followed by the platform name "
+      "to create project files for a specific target platform. E.g. "
+      "\"Visual Studio 12 Win64\" will create project files for "
+      "the x64 processor; \"Visual Studio 12 ARM\" for ARM.";
+  }
+
+  virtual void GetGenerators(std::vector<std::string>& names) const {
+    names.push_back(vs12Win32generatorName);
+    names.push_back(vs12Win64generatorName);
+    names.push_back(vs12ARMgeneratorName); }
+};
+
+//----------------------------------------------------------------------------
+cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory()
+{
+  return new Factory;
+}
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
+  const char* name, const char* architectureId,
+  const char* additionalPlatformDefinition)
+  : cmGlobalVisualStudio11Generator(name, architectureId,
+                                   additionalPlatformDefinition)
+{
+  this->FindMakeProgramFile = "CMakeVS12FindMake.cmake";
+  std::string vc12Express;
+  this->ExpressEdition = cmSystemTools::ReadRegistryValue(
+    "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\12.0\\Setup\\VC;"
+    "ProductDir", vc12Express, cmSystemTools::KeyWOW64_32);
+  this->PlatformToolset = "v120";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout)
+{
+  fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
+  if (this->ExpressEdition)
+    {
+    fout << "# Visual Studio Express 2013 for Windows Desktop\n";
+    }
+  else
+    {
+    fout << "# Visual Studio 2013\n";
+    }
+}
+
+//----------------------------------------------------------------------------
+cmLocalGenerator *cmGlobalVisualStudio12Generator::CreateLocalGenerator()
+{
+  cmLocalVisualStudio10Generator* lg =
+    new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12);
+  lg->SetPlatformName(this->GetPlatformName());
+  lg->SetGlobalGenerator(this);
+  return lg;
+}
+
+//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio12Generator::UseFolderProperty()
+{
+  // Intentionally skip over the parent class implementation and call the
+  // grand-parent class's implementation. Folders are not supported by the
+  // Express editions in VS10 and earlier, but they are in VS12 Express.
+  return cmGlobalVisualStudio8Generator::UseFolderProperty();
+}
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
new file mode 100644
index 000000000..5844ee01e
--- /dev/null
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -0,0 +1,40 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+#ifndef cmGlobalVisualStudio12Generator_h
+#define cmGlobalVisualStudio12Generator_h
+
+#include "cmGlobalVisualStudio11Generator.h"
+
+
+/** \class cmGlobalVisualStudio12Generator  */
+class cmGlobalVisualStudio12Generator:
+  public cmGlobalVisualStudio11Generator
+{
+public:
+  cmGlobalVisualStudio12Generator(const char* name,
+    const char* architectureId, const char* additionalPlatformDefinition);
+  static cmGlobalGeneratorFactory* NewFactory();
+
+  virtual void WriteSLNHeader(std::ostream& fout);
+
+  ///! create the correct local generator
+  virtual cmLocalGenerator *CreateLocalGenerator();
+
+  /** TODO: VS 12 user macro support. */
+  virtual std::string GetUserMacrosDirectory() { return ""; }
+protected:
+  virtual const char* GetIDEVersion() { return "12.0"; }
+  bool UseFolderProperty();
+private:
+  class Factory;
+};
+#endif
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 9968592d1..1a3499a96 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -38,7 +38,8 @@ public:
     VS8 = 80,
     VS9 = 90,
     VS10 = 100,
-    VS11 = 110
+    VS11 = 110,
+    VS12 = 120
   };
 
   cmLocalVisualStudioGenerator(VSVersion v);
diff --git a/Source/cmVS12CLFlagTable.h b/Source/cmVS12CLFlagTable.h
new file mode 100644
index 000000000..8f5131989
--- /dev/null
+++ b/Source/cmVS12CLFlagTable.h
@@ -0,0 +1,297 @@
+static cmVS7FlagTable cmVS12CLFlagTable[] =
+{
+
+  //Enum Properties
+  {"DebugInformationFormat", "",
+   "None", "None", 0},
+  {"DebugInformationFormat", "Z7",
+   "C7 compatible", "OldStyle", 0},
+  {"DebugInformationFormat", "Zi",
+   "Program Database", "ProgramDatabase", 0},
+  {"DebugInformationFormat", "ZI",
+   "Program Database for Edit And Continue", "EditAndContinue", 0},
+
+  {"WarningLevel", "W0",
+   "Turn Off All Warnings", "TurnOffAllWarnings", 0},
+  {"WarningLevel", "W1",
+   "Level1", "Level1", 0},
+  {"WarningLevel", "W2",
+   "Level2", "Level2", 0},
+  {"WarningLevel", "W3",
+   "Level3", "Level3", 0},
+  {"WarningLevel", "W4",
+   "Level4", "Level4", 0},
+  {"WarningLevel", "Wall",
+   "EnableAllWarnings", "EnableAllWarnings", 0},
+
+  {"Optimization", "",
+   "Custom", "Custom", 0},
+  {"Optimization", "Od",
+   "Disabled", "Disabled", 0},
+  {"Optimization", "O1",
+   "Minimize Size", "MinSpace", 0},
+  {"Optimization", "O2",
+   "Maximize Speed", "MaxSpeed", 0},
+  {"Optimization", "Ox",
+   "Full Optimization", "Full", 0},
+
+  {"InlineFunctionExpansion", "",
+   "Default", "Default", 0},
+  {"InlineFunctionExpansion", "Ob0",
+   "Disabled", "Disabled", 0},
+  {"InlineFunctionExpansion", "Ob1",
+   "Only __inline", "OnlyExplicitInline", 0},
+  {"InlineFunctionExpansion", "Ob2",
+   "Any Suitable", "AnySuitable", 0},
+
+  {"FavorSizeOrSpeed", "Os",
+   "Favor small code", "Size", 0},
+  {"FavorSizeOrSpeed", "Ot",
+   "Favor fast code", "Speed", 0},
+  {"FavorSizeOrSpeed", "",
+   "Neither", "Neither", 0},
+
+  {"ExceptionHandling", "EHa",
+   "Yes with SEH Exceptions", "Async", 0},
+  {"ExceptionHandling", "EHsc",
+   "Yes", "Sync", 0},
+  {"ExceptionHandling", "EHs",
+   "Yes with Extern C functions", "SyncCThrow", 0},
+  {"ExceptionHandling", "",
+   "No", "false", 0},
+
+  {"BasicRuntimeChecks", "RTCs",
+   "Stack Frames", "StackFrameRuntimeCheck", 0},
+  {"BasicRuntimeChecks", "RTCu",
+   "Uninitialized variables", "UninitializedLocalUsageCheck", 0},
+  {"BasicRuntimeChecks", "RTC1",
+   "Both (/RTC1, equiv. to /RTCsu)", "EnableFastChecks", 0},
+  {"BasicRuntimeChecks", "",
+   "Default", "Default", 0},
+
+  {"RuntimeLibrary", "MT",
+   "Multi-threaded", "MultiThreaded", 0},
+  {"RuntimeLibrary", "MTd",
+   "Multi-threaded Debug", "MultiThreadedDebug", 0},
+  {"RuntimeLibrary", "MD",
+   "Multi-threaded DLL", "MultiThreadedDLL", 0},
+  {"RuntimeLibrary", "MDd",
+   "Multi-threaded Debug DLL", "MultiThreadedDebugDLL", 0},
+
+  {"StructMemberAlignment", "Zp1",
+   "1 Byte", "1Byte", 0},
+  {"StructMemberAlignment", "Zp2",
+   "2 Bytes", "2Bytes", 0},
+  {"StructMemberAlignment", "Zp4",
+   "4 Byte", "4Bytes", 0},
+  {"StructMemberAlignment", "Zp8",
+   "8 Bytes", "8Bytes", 0},
+  {"StructMemberAlignment", "Zp16",
+   "16 Bytes", "16Bytes", 0},
+  {"StructMemberAlignment", "",
+   "Default", "Default", 0},
+
+  {"BufferSecurityCheck", "GS-",
+   "Disable Security Check", "false", 0},
+  {"BufferSecurityCheck", "GS",
+   "Enable Security Check", "true", 0},
+
+  {"EnableEnhancedInstructionSet", "arch:SSE",
+   "Streaming SIMD Extensions", "StreamingSIMDExtensions", 0},
+  {"EnableEnhancedInstructionSet", "arch:SSE2",
+   "Streaming SIMD Extensions 2", "StreamingSIMDExtensions2", 0},
+  {"EnableEnhancedInstructionSet", "arch:AVX",
+   "Advanced Vector Extensions", "AdvancedVectorExtensions", 0},
+  {"EnableEnhancedInstructionSet", "arch:IA32",
+   "No Enhanced Instructions", "NoExtensions", 0},
+  {"EnableEnhancedInstructionSet", "",
+   "Not Set", "NotSet", 0},
+
+  {"FloatingPointModel", "fp:precise",
+   "Precise", "Precise", 0},
+  {"FloatingPointModel", "fp:strict",
+   "Strict", "Strict", 0},
+  {"FloatingPointModel", "fp:fast",
+   "Fast", "Fast", 0},
+
+  {"PrecompiledHeader", "Yc",
+   "Create", "Create",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"PrecompiledHeader", "Yu",
+   "Use", "Use",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"PrecompiledHeader", "",
+   "Not Using Precompiled Headers", "NotUsing", 0},
+
+  {"AssemblerOutput", "",
+   "No Listing", "NoListing", 0},
+  {"AssemblerOutput", "FA",
+   "Assembly-Only Listing", "AssemblyCode", 0},
+  {"AssemblerOutput", "FAc",
+   "Assembly With Machine Code", "AssemblyAndMachineCode", 0},
+  {"AssemblerOutput", "FAs",
+   "Assembly With Source Code", "AssemblyAndSourceCode", 0},
+  {"AssemblerOutput", "FAcs",
+   "Assembly, Machine Code and Source", "All", 0},
+
+  {"CallingConvention", "Gd",
+   "__cdecl", "Cdecl", 0},
+  {"CallingConvention", "Gr",
+   "__fastcall", "FastCall", 0},
+  {"CallingConvention", "Gz",
+   "__stdcall", "StdCall", 0},
+  {"CallingConvention", "Gv",
+   "__vectorcall", "VectorCall", 0},
+
+  {"CompileAs", "",
+   "Default", "Default", 0},
+  {"CompileAs", "TC",
+   "Compile as C Code", "CompileAsC", 0},
+  {"CompileAs", "TP",
+   "Compile as C++ Code", "CompileAsCpp", 0},
+
+  {"ErrorReporting", "errorReport:none",
+   "Do Not Send Report", "None", 0},
+  {"ErrorReporting", "errorReport:prompt",
+   "Prompt Immediately", "Prompt", 0},
+  {"ErrorReporting", "errorReport:queue",
+   "Queue For Next Login", "Queue", 0},
+  {"ErrorReporting", "errorReport:send",
+   "Send Automatically", "Send", 0},
+
+  {"CompileAsManaged", "",
+   "No Common Language RunTime Support", "false", 0},
+  {"CompileAsManaged", "clr",
+   "Common Language RunTime Support", "true", 0},
+  {"CompileAsManaged", "clr:pure",
+   "Pure MSIL Common Language RunTime Support", "Pure", 0},
+  {"CompileAsManaged", "clr:safe",
+   "Safe MSIL Common Language RunTime Support", "Safe", 0},
+  {"CompileAsManaged", "clr:oldSyntax",
+   "Common Language RunTime Support, Old Syntax", "OldSyntax", 0},
+
+
+  //Bool Properties
+  {"CompileAsWinRT", "ZW", "", "true", 0},
+  {"WinRTNoStdLib", "ZW:nostdlib", "", "true", 0},
+  {"SuppressStartupBanner", "nologo", "", "true", 0},
+  {"TreatWarningAsError", "WX-", "", "false", 0},
+  {"TreatWarningAsError", "WX", "", "true", 0},
+  {"SDLCheck", "sdl-", "", "false", 0},
+  {"SDLCheck", "sdl", "", "true", 0},
+  {"IntrinsicFunctions", "Oi", "", "true", 0},
+  {"OmitFramePointers", "Oy-", "", "false", 0},
+  {"OmitFramePointers", "Oy", "", "true", 0},
+  {"EnableFiberSafeOptimizations", "GT", "", "true", 0},
+  {"WholeProgramOptimization", "GL", "", "true", 0},
+  {"UndefineAllPreprocessorDefinitions", "u", "", "true", 0},
+  {"IgnoreStandardIncludePath", "X", "", "true", 0},
+  {"PreprocessToFile", "P", "", "true", 0},
+  {"PreprocessSuppressLineNumbers", "EP", "", "true", 0},
+  {"PreprocessKeepComments", "C", "", "true", 0},
+  {"StringPooling", "GF-", "", "false", 0},
+  {"StringPooling", "GF", "", "true", 0},
+  {"MinimalRebuild", "Gm-", "", "false", 0},
+  {"MinimalRebuild", "Gm", "", "true", 0},
+  {"SmallerTypeCheck", "RTCc", "", "true", 0},
+  {"FunctionLevelLinking", "Gy-", "", "false", 0},
+  {"FunctionLevelLinking", "Gy", "", "true", 0},
+  {"EnableParallelCodeGeneration", "Qpar-", "", "false", 0},
+  {"EnableParallelCodeGeneration", "Qpar", "", "true", 0},
+  {"FloatingPointExceptions", "fp:except-", "", "false", 0},
+  {"FloatingPointExceptions", "fp:except", "", "true", 0},
+  {"CreateHotpatchableImage", "hotpatch", "", "true", 0},
+  {"DisableLanguageExtensions", "Za", "", "true", 0},
+  {"TreatWChar_tAsBuiltInType", "Zc:wchar_t-", "", "false", 0},
+  {"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0},
+  {"ForceConformanceInForLoopScope", "Zc:forScope-", "", "false", 0},
+  {"ForceConformanceInForLoopScope", "Zc:forScope", "", "true", 0},
+  {"RuntimeTypeInfo", "GR-", "", "false", 0},
+  {"RuntimeTypeInfo", "GR", "", "true", 0},
+  {"OpenMPSupport", "openmp-", "", "false", 0},
+  {"OpenMPSupport", "openmp", "", "true", 0},
+  {"ExpandAttributedSource", "Fx", "", "true", 0},
+  {"UseUnicodeForAssemblerListing", "FAu", "", "true", 0},
+  {"ShowIncludes", "showIncludes", "", "true", 0},
+  {"EnablePREfast", "analyze-", "", "false", 0},
+  {"EnablePREfast", "analyze", "", "true", 0},
+  {"UseFullPaths", "FC", "", "true", 0},
+  {"OmitDefaultLibName", "Zl", "", "true", 0},
+
+  //Bool Properties With Argument
+  {"MultiProcessorCompilation", "MP", "", "true",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"ProcessorNumber", "MP", "Multi-processor Compilation", "",
+   cmVS7FlagTable::UserValueRequired},
+  {"GenerateXMLDocumentationFiles", "doc", "", "true",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"XMLDocumentationFileName", "doc", "Generate XML Documentation Files", "",
+   cmVS7FlagTable::UserValueRequired},
+  {"BrowseInformation", "FR", "", "true",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"BrowseInformationFile", "FR", "Enable Browse Information", "",
+   cmVS7FlagTable::UserValueRequired},
+
+  //String List Properties
+  {"AdditionalIncludeDirectories", "I",
+   "Additional Include Directories",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"AdditionalUsingDirectories", "AI",
+   "Additional #using Directories",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"PreprocessorDefinitions", "D ",
+   "Preprocessor Definitions",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"UndefinePreprocessorDefinitions", "U",
+   "Undefine Preprocessor Definitions",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"DisableSpecificWarnings", "wd",
+   "Disable Specific Warnings",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"ForcedIncludeFiles", "FI",
+   "Forced Include File",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"ForcedUsingFiles", "FU",
+   "Forced #using File",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"PREfastAdditionalOptions", "analyze:",
+   "Additional Code Analysis Native options",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"PREfastAdditionalPlugins", "analyze:plugin",
+   "Additional Code Analysis Native plugins",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"TreatSpecificWarningsAsErrors", "we",
+   "Treat Specific Warnings As Errors",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+
+  //String Properties
+  // Skip [TrackerLogDirectory] - no command line Switch.
+  {"PreprocessOutputPath", "Fi",
+   "Preprocess Output Path",
+   "", cmVS7FlagTable::UserValue},
+  {"PrecompiledHeaderFile", "Yc",
+   "Precompiled Header Name",
+   "", cmVS7FlagTable::UserValueRequired},
+  {"PrecompiledHeaderFile", "Yu",
+   "Precompiled Header Name",
+   "", cmVS7FlagTable::UserValueRequired},
+  {"PrecompiledHeaderOutputFile", "Fp",
+   "Precompiled Header Output File",
+   "", cmVS7FlagTable::UserValue},
+  {"AssemblerListingLocation", "Fa",
+   "ASM List Location",
+   "", cmVS7FlagTable::UserValue},
+  {"ObjectFileName", "Fo",
+   "Object File Name",
+   "", cmVS7FlagTable::UserValue},
+  {"ProgramDataBaseFileName", "Fd",
+   "Program Database File Name",
+   "", cmVS7FlagTable::UserValue},
+  // Skip [XMLDocumentationFileName] - no command line Switch.
+  // Skip [BrowseInformationFile] - no command line Switch.
+  {"PREfastLog", "analyze:log ",
+   "Code Analysis Log",
+   "", cmVS7FlagTable::UserValue},
+  // Skip [AdditionalOptions] - no command line Switch.
+  {0,0,0,0,0}
+};
diff --git a/Source/cmVS12LibFlagTable.h b/Source/cmVS12LibFlagTable.h
new file mode 100644
index 000000000..10bb8057f
--- /dev/null
+++ b/Source/cmVS12LibFlagTable.h
@@ -0,0 +1,102 @@
+static cmVS7FlagTable cmVS12LibFlagTable[] =
+{
+
+  //Enum Properties
+  {"ErrorReporting", "ERRORREPORT:PROMPT",
+   "PromptImmediately", "PromptImmediately", 0},
+  {"ErrorReporting", "ERRORREPORT:QUEUE",
+   "Queue For Next Login", "QueueForNextLogin", 0},
+  {"ErrorReporting", "ERRORREPORT:SEND",
+   "Send Error Report", "SendErrorReport", 0},
+  {"ErrorReporting", "ERRORREPORT:NONE",
+   "No Error Report", "NoErrorReport", 0},
+
+  {"TargetMachine", "MACHINE:ARM",
+   "MachineARM", "MachineARM", 0},
+  {"TargetMachine", "MACHINE:EBC",
+   "MachineEBC", "MachineEBC", 0},
+  {"TargetMachine", "MACHINE:IA64",
+   "MachineIA64", "MachineIA64", 0},
+  {"TargetMachine", "MACHINE:MIPS",
+   "MachineMIPS", "MachineMIPS", 0},
+  {"TargetMachine", "MACHINE:MIPS16",
+   "MachineMIPS16", "MachineMIPS16", 0},
+  {"TargetMachine", "MACHINE:MIPSFPU",
+   "MachineMIPSFPU", "MachineMIPSFPU", 0},
+  {"TargetMachine", "MACHINE:MIPSFPU16",
+   "MachineMIPSFPU16", "MachineMIPSFPU16", 0},
+  {"TargetMachine", "MACHINE:SH4",
+   "MachineSH4", "MachineSH4", 0},
+  {"TargetMachine", "MACHINE:THUMB",
+   "MachineTHUMB", "MachineTHUMB", 0},
+  {"TargetMachine", "MACHINE:X64",
+   "MachineX64", "MachineX64", 0},
+  {"TargetMachine", "MACHINE:X86",
+   "MachineX86", "MachineX86", 0},
+
+  {"SubSystem", "SUBSYSTEM:CONSOLE",
+   "Console", "Console", 0},
+  {"SubSystem", "SUBSYSTEM:WINDOWS",
+   "Windows", "Windows", 0},
+  {"SubSystem", "SUBSYSTEM:NATIVE",
+   "Native", "Native", 0},
+  {"SubSystem", "SUBSYSTEM:EFI_APPLICATION",
+   "EFI Application", "EFI Application", 0},
+  {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER",
+   "EFI Boot Service Driver", "EFI Boot Service Driver", 0},
+  {"SubSystem", "SUBSYSTEM:EFI_ROM",
+   "EFI ROM", "EFI ROM", 0},
+  {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER",
+   "EFI Runtime", "EFI Runtime", 0},
+  {"SubSystem", "SUBSYSTEM:WINDOWSCE",
+   "WindowsCE", "WindowsCE", 0},
+  {"SubSystem", "SUBSYSTEM:POSIX",
+   "POSIX", "POSIX", 0},
+
+
+  //Bool Properties
+  {"SuppressStartupBanner", "NOLOGO", "", "true", 0},
+  {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "", "true", 0},
+  {"TreatLibWarningAsErrors", "WX:NO", "", "false", 0},
+  {"TreatLibWarningAsErrors", "WX", "", "true", 0},
+  {"Verbose", "VERBOSE", "", "true", 0},
+  {"LinkTimeCodeGeneration", "LTCG", "", "true", 0},
+
+  //Bool Properties With Argument
+
+  //String List Properties
+  // Skip [AdditionalDependencies] - no command line Switch.
+  {"AdditionalLibraryDirectories", "LIBPATH:",
+   "Additional Library Directories",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:",
+   "Ignore Specific Default Libraries",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"ExportNamedFunctions", "EXPORT:",
+   "Export Named Functions",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"RemoveObjects", "REMOVE:",
+   "Remove Objects",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+
+  //String Properties
+  {"OutputFile", "OUT:",
+   "Output File",
+   "", cmVS7FlagTable::UserValue},
+  {"ModuleDefinitionFile", "DEF:",
+   "Module Definition File Name",
+   "", cmVS7FlagTable::UserValue},
+  {"ForceSymbolReferences", "INCLUDE:",
+   "Force Symbol References",
+   "", cmVS7FlagTable::UserValue},
+  {"DisplayLibrary", "LIST:",
+   "Display Library to standard output",
+   "", cmVS7FlagTable::UserValue},
+  // Skip [MinimumRequiredVersion] - no command line Switch.
+  {"Name", "NAME:",
+   "Name",
+   "", cmVS7FlagTable::UserValue},
+  // Skip [AdditionalOptions] - no command line Switch.
+  // Skip [TrackerLogDirectory] - no command line Switch.
+  {0,0,0,0,0}
+};
diff --git a/Source/cmVS12LinkFlagTable.h b/Source/cmVS12LinkFlagTable.h
new file mode 100644
index 000000000..ce32e3815
--- /dev/null
+++ b/Source/cmVS12LinkFlagTable.h
@@ -0,0 +1,343 @@
+static cmVS7FlagTable cmVS12LinkFlagTable[] =
+{
+
+  //Enum Properties
+  {"ShowProgress", "",
+   "Not Set", "NotSet", 0},
+  {"ShowProgress", "VERBOSE",
+   "Display all progress messages", "LinkVerbose", 0},
+  {"ShowProgress", "VERBOSE:Lib",
+   "For Libraries Searched", "LinkVerboseLib", 0},
+  {"ShowProgress", "VERBOSE:ICF",
+   "About COMDAT folding during optimized linking", "LinkVerboseICF", 0},
+  {"ShowProgress", "VERBOSE:REF",
+   "About data removed during optimized linking", "LinkVerboseREF", 0},
+  {"ShowProgress", "VERBOSE:SAFESEH",
+   "About Modules incompatible with SEH", "LinkVerboseSAFESEH", 0},
+  {"ShowProgress", "VERBOSE:CLR",
+   "About linker activity related to managed code", "LinkVerboseCLR", 0},
+
+  {"ForceFileOutput", "FORCE",
+   "Enabled", "Enabled", 0},
+  {"ForceFileOutput", "FORCE:MULTIPLE",
+   "Multiply Defined Symbol Only", "MultiplyDefinedSymbolOnly", 0},
+  {"ForceFileOutput", "FORCE:UNRESOLVED",
+   "Undefined Symbol Only", "UndefinedSymbolOnly", 0},
+
+  {"CreateHotPatchableImage", "FUNCTIONPADMIN",
+   "Enabled", "Enabled", 0},
+  {"CreateHotPatchableImage", "FUNCTIONPADMIN:5",
+   "X86 Image Only", "X86Image", 0},
+  {"CreateHotPatchableImage", "FUNCTIONPADMIN:6",
+   "X64 Image Only", "X64Image", 0},
+  {"CreateHotPatchableImage", "FUNCTIONPADMIN:16",
+   "Itanium Image Only", "ItaniumImage", 0},
+
+  {"UACExecutionLevel", "level='asInvoker'",
+   "asInvoker", "AsInvoker", 0},
+  {"UACExecutionLevel", "level='highestAvailable'",
+   "highestAvailable", "HighestAvailable", 0},
+  {"UACExecutionLevel", "level='requireAdministrator'",
+   "requireAdministrator", "RequireAdministrator", 0},
+
+  {"SubSystem", "",
+   "Not Set", "NotSet", 0},
+  {"SubSystem", "SUBSYSTEM:CONSOLE",
+   "Console", "Console", 0},
+  {"SubSystem", "SUBSYSTEM:WINDOWS",
+   "Windows", "Windows", 0},
+  {"SubSystem", "SUBSYSTEM:NATIVE",
+   "Native", "Native", 0},
+  {"SubSystem", "SUBSYSTEM:EFI_APPLICATION",
+   "EFI Application", "EFI Application", 0},
+  {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER",
+   "EFI Boot Service Driver", "EFI Boot Service Driver", 0},
+  {"SubSystem", "SUBSYSTEM:EFI_ROM",
+   "EFI ROM", "EFI ROM", 0},
+  {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER",
+   "EFI Runtime", "EFI Runtime", 0},
+  {"SubSystem", "SUBSYSTEM:POSIX",
+   "POSIX", "POSIX", 0},
+
+  {"Driver", "",
+   "Not Set", "NotSet", 0},
+  {"Driver", "Driver",
+   "Driver", "Driver", 0},
+  {"Driver", "DRIVER:UPONLY",
+   "UP Only", "UpOnly", 0},
+  {"Driver", "DRIVER:WDM",
+   "WDM", "WDM", 0},
+
+  {"LinkTimeCodeGeneration", "",
+   "Default", "Default", 0},
+  {"LinkTimeCodeGeneration", "LTCG",
+   "Use Link Time Code Generation", "UseLinkTimeCodeGeneration", 0},
+  {"LinkTimeCodeGeneration", "LTCG:PGInstrument",
+   "Profile Guided Optimization - Instrument", "PGInstrument", 0},
+  {"LinkTimeCodeGeneration", "LTCG:PGOptimize",
+   "Profile Guided Optimization - Optimization", "PGOptimization", 0},
+  {"LinkTimeCodeGeneration", "LTCG:PGUpdate",
+   "Profile Guided Optimization - Update", "PGUpdate", 0},
+
+  {"GenerateWindowsMetadata", "WINMD",
+   "Yes", "true", 0},
+  {"GenerateWindowsMetadata", "WINMD:NO",
+   "No", "false", 0},
+
+  {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA1",
+   "SHA1", "SHA1", 0},
+  {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA256",
+   "SHA256", "SHA256", 0},
+  {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA384",
+   "SHA384", "SHA384", 0},
+  {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA512",
+   "SHA512", "SHA512", 0},
+
+  {"TargetMachine", "",
+   "Not Set", "NotSet", 0},
+  {"TargetMachine", "MACHINE:ARM",
+   "MachineARM", "MachineARM", 0},
+  {"TargetMachine", "MACHINE:EBC",
+   "MachineEBC", "MachineEBC", 0},
+  {"TargetMachine", "MACHINE:IA64",
+   "MachineIA64", "MachineIA64", 0},
+  {"TargetMachine", "MACHINE:MIPS",
+   "MachineMIPS", "MachineMIPS", 0},
+  {"TargetMachine", "MACHINE:MIPS16",
+   "MachineMIPS16", "MachineMIPS16", 0},
+  {"TargetMachine", "MACHINE:MIPSFPU",
+   "MachineMIPSFPU", "MachineMIPSFPU", 0},
+  {"TargetMachine", "MACHINE:MIPSFPU16",
+   "MachineMIPSFPU16", "MachineMIPSFPU16", 0},
+  {"TargetMachine", "MACHINE:SH4",
+   "MachineSH4", "MachineSH4", 0},
+  {"TargetMachine", "MACHINE:THUMB",
+   "MachineTHUMB", "MachineTHUMB", 0},
+  {"TargetMachine", "MACHINE:X64",
+   "MachineX64", "MachineX64", 0},
+  {"TargetMachine", "MACHINE:X86",
+   "MachineX86", "MachineX86", 0},
+
+  {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:MTA",
+   "MTA threading attribute", "MTAThreadingAttribute", 0},
+  {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:STA",
+   "STA threading attribute", "STAThreadingAttribute", 0},
+  {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:NONE",
+   "Default threading attribute", "DefaultThreadingAttribute", 0},
+
+  {"CLRImageType", "CLRIMAGETYPE:IJW",
+   "Force IJW image", "ForceIJWImage", 0},
+  {"CLRImageType", "CLRIMAGETYPE:PURE",
+   "Force Pure IL Image", "ForcePureILImage", 0},
+  {"CLRImageType", "CLRIMAGETYPE:SAFE",
+   "Force Safe IL Image", "ForceSafeILImage", 0},
+  {"CLRImageType", "",
+   "Default image type", "Default", 0},
+
+  {"SignHash", "CLRSIGNHASH:SHA1",
+   "SHA1", "SHA1", 0},
+  {"SignHash", "CLRSIGNHASH:SHA256",
+   "SHA256", "SHA256", 0},
+  {"SignHash", "CLRSIGNHASH:SHA384",
+   "SHA384", "SHA384", 0},
+  {"SignHash", "CLRSIGNHASH:SHA512",
+   "SHA512", "SHA512", 0},
+
+  {"LinkErrorReporting", "ERRORREPORT:PROMPT",
+   "PromptImmediately", "PromptImmediately", 0},
+  {"LinkErrorReporting", "ERRORREPORT:QUEUE",
+   "Queue For Next Login", "QueueForNextLogin", 0},
+  {"LinkErrorReporting", "ERRORREPORT:SEND",
+   "Send Error Report", "SendErrorReport", 0},
+  {"LinkErrorReporting", "ERRORREPORT:NONE",
+   "No Error Report", "NoErrorReport", 0},
+
+  {"CLRSupportLastError", "CLRSupportLastError",
+   "Enabled", "Enabled", 0},
+  {"CLRSupportLastError", "CLRSupportLastError:NO",
+   "Disabled", "Disabled", 0},
+  {"CLRSupportLastError", "CLRSupportLastError:SYSTEMDLL",
+   "System Dlls Only", "SystemDlls", 0},
+
+
+  //Bool Properties
+  {"LinkIncremental", "INCREMENTAL:NO", "", "false", 0},
+  {"LinkIncremental", "INCREMENTAL", "", "true", 0},
+  {"SuppressStartupBanner", "NOLOGO", "", "true", 0},
+  {"LinkStatus", "LTCG:NOSTATUS", "", "false", 0},
+  {"LinkStatus", "LTCG:STATUS", "", "true", 0},
+  {"PreventDllBinding", "ALLOWBIND:NO", "", "false", 0},
+  {"PreventDllBinding", "ALLOWBIND", "", "true", 0},
+  {"TreatLinkerWarningAsErrors", "WX:NO", "", "false", 0},
+  {"TreatLinkerWarningAsErrors", "WX", "", "true", 0},
+  {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "", "true", 0},
+  {"GenerateManifest", "MANIFEST:NO", "", "false", 0},
+  {"GenerateManifest", "MANIFEST", "", "true", 0},
+  {"AllowIsolation", "ALLOWISOLATION:NO", "", "false", 0},
+  {"UACUIAccess", "uiAccess='false'", "", "false", 0},
+  {"UACUIAccess", "uiAccess='true'", "", "true", 0},
+  {"ManifestEmbed", "manifest:embed", "", "true", 0},
+  {"GenerateDebugInformation", "DEBUG", "", "true", 0},
+  {"MapExports", "MAPINFO:EXPORTS", "", "true", 0},
+  {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0},
+  {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0},
+  {"LargeAddressAware", "LARGEADDRESSAWARE:NO", "", "false", 0},
+  {"LargeAddressAware", "LARGEADDRESSAWARE", "", "true", 0},
+  {"TerminalServerAware", "TSAWARE:NO", "", "false", 0},
+  {"TerminalServerAware", "TSAWARE", "", "true", 0},
+  {"SwapRunFromCD", "SWAPRUN:CD", "", "true", 0},
+  {"SwapRunFromNET", "SWAPRUN:NET", "", "true", 0},
+  {"OptimizeReferences", "OPT:NOREF", "", "false", 0},
+  {"OptimizeReferences", "OPT:REF", "", "true", 0},
+  {"EnableCOMDATFolding", "OPT:NOICF", "", "false", 0},
+  {"EnableCOMDATFolding", "OPT:ICF", "", "true", 0},
+  {"IgnoreEmbeddedIDL", "IGNOREIDL", "", "true", 0},
+  {"AppContainer", "APPCONTAINER", "", "true", 0},
+  {"WindowsMetadataLinkDelaySign", "WINMDDELAYSIGN:NO", "", "false", 0},
+  {"WindowsMetadataLinkDelaySign", "WINMDDELAYSIGN", "", "true", 0},
+  {"NoEntryPoint", "NOENTRY", "", "true", 0},
+  {"SetChecksum", "RELEASE", "", "true", 0},
+  {"RandomizedBaseAddress", "DYNAMICBASE:NO", "", "false", 0},
+  {"RandomizedBaseAddress", "DYNAMICBASE", "", "true", 0},
+  {"FixedBaseAddress", "FIXED:NO", "", "false", 0},
+  {"FixedBaseAddress", "FIXED", "", "true", 0},
+  {"DataExecutionPrevention", "NXCOMPAT:NO", "", "false", 0},
+  {"DataExecutionPrevention", "NXCOMPAT", "", "true", 0},
+  {"TurnOffAssemblyGeneration", "NOASSEMBLY", "", "true", 0},
+  {"SupportUnloadOfDelayLoadedDLL", "DELAY:UNLOAD", "", "true", 0},
+  {"SupportNobindOfDelayLoadedDLL", "DELAY:NOBIND", "", "true", 0},
+  {"Profile", "PROFILE", "", "true", 0},
+  {"LinkDelaySign", "DELAYSIGN:NO", "", "false", 0},
+  {"LinkDelaySign", "DELAYSIGN", "", "true", 0},
+  {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK:NO", "", "false", 0},
+  {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK", "", "true", 0},
+  {"DetectOneDefinitionRule", "ODR", "", "true", 0},
+  {"ImageHasSafeExceptionHandlers", "SAFESEH:NO", "", "false", 0},
+  {"ImageHasSafeExceptionHandlers", "SAFESEH", "", "true", 0},
+  {"LinkDLL", "DLL", "", "true", 0},
+
+  //Bool Properties With Argument
+  {"EnableUAC", "MANIFESTUAC:NO", "", "false",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"EnableUAC", "MANIFESTUAC:NO", "Enable User Account Control (UAC)", "",
+   cmVS7FlagTable::UserValueRequired},
+  {"EnableUAC", "MANIFESTUAC:", "", "true",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "",
+   cmVS7FlagTable::UserValueRequired},
+  {"GenerateMapFile", "MAP", "", "true",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"MapFileName", "MAP", "Generate Map File", "",
+   cmVS7FlagTable::UserValueRequired},
+
+  //String List Properties
+  {"AdditionalLibraryDirectories", "LIBPATH:",
+   "Additional Library Directories",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  // Skip [AdditionalDependencies] - no command line Switch.
+  {"IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:",
+   "Ignore Specific Default Libraries",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"AddModuleNamesToAssembly", "ASSEMBLYMODULE:",
+   "Add Module to Assembly",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"EmbedManagedResourceFile", "ASSEMBLYRESOURCE:",
+   "Embed Managed Resource File",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"ForceSymbolReferences", "INCLUDE:",
+   "Force Symbol References",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"DelayLoadDLLs", "DELAYLOAD:",
+   "Delay Loaded Dlls",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"AssemblyLinkResource", "ASSEMBLYLINKRESOURCE:",
+   "Assembly Link Resource",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"AdditionalManifestDependencies", "MANIFESTDEPENDENCY:",
+   "Additional Manifest Dependencies",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+  {"ManifestInput", "manifestinput:",
+   "Manifest Input",
+   "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
+
+  //String Properties
+  {"OutputFile", "OUT:",
+   "Output File",
+   "", cmVS7FlagTable::UserValue},
+  {"Version", "VERSION:",
+   "Version",
+   "", cmVS7FlagTable::UserValue},
+  {"SpecifySectionAttributes", "SECTION:",
+   "Specify Section Attributes",
+   "", cmVS7FlagTable::UserValue},
+  {"MSDOSStubFileName", "STUB:",
+   "MS-DOS Stub File Name",
+   "", cmVS7FlagTable::UserValue},
+  // Skip [TrackerLogDirectory] - no command line Switch.
+  {"ModuleDefinitionFile", "DEF:",
+   "Module Definition File",
+   "", cmVS7FlagTable::UserValue},
+  {"ManifestFile", "ManifestFile:",
+   "Manifest File",
+   "", cmVS7FlagTable::UserValue},
+  {"ProgramDatabaseFile", "PDB:",
+   "Generate Program Database File",
+   "", cmVS7FlagTable::UserValue},
+  {"StripPrivateSymbols", "PDBSTRIPPED:",
+   "Strip Private Symbols",
+   "", cmVS7FlagTable::UserValue},
+  // Skip [MapFileName] - no command line Switch.
+  // Skip [MinimumRequiredVersion] - no command line Switch.
+  {"HeapReserveSize", "HEAP:",
+   "Heap Reserve Size",
+   "", cmVS7FlagTable::UserValue},
+  // Skip [HeapCommitSize] - no command line Switch.
+  {"StackReserveSize", "STACK:",
+   "Stack Reserve Size",
+   "", cmVS7FlagTable::UserValue},
+  // Skip [StackCommitSize] - no command line Switch.
+  {"FunctionOrder", "ORDER:@",
+   "Function Order",
+   "", cmVS7FlagTable::UserValue},
+  {"ProfileGuidedDatabase", "PGD:",
+   "Profile Guided Database",
+   "", cmVS7FlagTable::UserValue},
+  {"MidlCommandFile", "MIDL:@",
+   "MIDL Commands",
+   "", cmVS7FlagTable::UserValue},
+  {"MergedIDLBaseFileName", "IDLOUT:",
+   "Merged IDL Base File Name",
+   "", cmVS7FlagTable::UserValue},
+  {"TypeLibraryFile", "TLBOUT:",
+   "Type Library",
+   "", cmVS7FlagTable::UserValue},
+  {"WindowsMetadataFile", "WINMDFILE:",
+   "Windows Metadata File",
+   "", cmVS7FlagTable::UserValue},
+  {"WindowsMetadataLinkKeyFile", "WINMDKEYFILE:",
+   "Windows Metadata Key File",
+   "", cmVS7FlagTable::UserValue},
+  {"WindowsMetadataKeyContainer", "WINMDKEYCONTAINER:",
+   "Windows Metadata Key Container",
+   "", cmVS7FlagTable::UserValue},
+  {"EntryPointSymbol", "ENTRY:",
+   "Entry Point",
+   "", cmVS7FlagTable::UserValue},
+  {"BaseAddress", "BASE:",
+   "Base Address",
+   "", cmVS7FlagTable::UserValue},
+  {"ImportLibrary", "IMPLIB:",
+   "Import Library",
+   "", cmVS7FlagTable::UserValue},
+  {"MergeSections", "MERGE:",
+   "Merge Sections",
+   "", cmVS7FlagTable::UserValue},
+  {"LinkKeyFile", "KEYFILE:",
+   "Key File",
+   "", cmVS7FlagTable::UserValue},
+  {"KeyContainer", "KEYCONTAINER:",
+   "Key Container",
+   "", cmVS7FlagTable::UserValue},
+  // Skip [AdditionalOptions] - no command line Switch.
+  {0,0,0,0,0}
+};
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 1cb9f2370..9cfb3703e 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -25,31 +25,43 @@
 #include "cmVS11CLFlagTable.h"
 #include "cmVS11LinkFlagTable.h"
 #include "cmVS11LibFlagTable.h"
+#include "cmVS12CLFlagTable.h"
+#include "cmVS12LinkFlagTable.h"
+#include "cmVS12LibFlagTable.h"
 
 #include <cmsys/auto_ptr.hxx>
 
 static cmVS7FlagTable const*
 cmVSGetCLFlagTable(cmLocalVisualStudioGenerator* lg)
 {
-  if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11)
+  if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+    { return cmVS12CLFlagTable; }
+  else if(lg->GetVersion() == cmLocalVisualStudioGenerator::VS11)
     { return cmVS11CLFlagTable; }
-  return cmVS10CLFlagTable;
+  else
+    { return cmVS10CLFlagTable; }
 }
 
 static cmVS7FlagTable const*
 cmVSGetLibFlagTable(cmLocalVisualStudioGenerator* lg)
 {
-  if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11)
+  if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+    { return cmVS12LibFlagTable; }
+  else if(lg->GetVersion() == cmLocalVisualStudioGenerator::VS11)
     { return cmVS11LibFlagTable; }
-  return cmVS10LibFlagTable;
+  else
+    { return cmVS10LibFlagTable; }
 }
 
 static cmVS7FlagTable const*
 cmVSGetLinkFlagTable(cmLocalVisualStudioGenerator* lg)
 {
-  if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11)
+  if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+    { return cmVS12LinkFlagTable; }
+  else if(lg->GetVersion() == cmLocalVisualStudioGenerator::VS11)
     { return cmVS11LinkFlagTable; }
-  return cmVS10LinkFlagTable;
+  else
+    { return cmVS10LinkFlagTable; }
 }
 
 static std::string cmVS10EscapeXML(std::string arg)
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 1df0d9ed1..01950e16d 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -66,6 +66,7 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault()
       break;
     case cmLocalVisualStudioGenerator::VS10:
     case cmLocalVisualStudioGenerator::VS11:
+    case cmLocalVisualStudioGenerator::VS12:
       // by default VS puts <ExceptionHandling></ExceptionHandling> empty
       // for a project, to make our projects look the same put a new line
       // and space over for the closing </ExceptionHandling> as the default
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e2f80d135..376758e48 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -65,6 +65,7 @@
 #    include "cmGlobalVisualStudio9Generator.h"
 #    include "cmGlobalVisualStudio10Generator.h"
 #    include "cmGlobalVisualStudio11Generator.h"
+#    include "cmGlobalVisualStudio12Generator.h"
 #    include "cmGlobalBorlandMakefileGenerator.h"
 #    include "cmGlobalNMakeMakefileGenerator.h"
 #    include "cmGlobalJOMMakefileGenerator.h"
@@ -2244,6 +2245,7 @@ int cmake::ActualConfigure()
         {"9.0", "Visual Studio 9 2008"},
         {"10.0", "Visual Studio 10"},
         {"11.0", "Visual Studio 11"},
+        {"12.0", "Visual Studio 12"},
         {0, 0}};
       for(int i=0; version[i].MSVersion != 0; i++)
         {
@@ -2652,6 +2654,8 @@ void cmake::AddDefaultGenerators()
     cmGlobalVisualStudio10Generator::NewFactory());
   this->Generators.push_back(
     cmGlobalVisualStudio11Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio12Generator::NewFactory());
   this->Generators.push_back(
     cmGlobalVisualStudio71Generator::NewFactory());
   this->Generators.push_back(
diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py
index 35b55ca25..d1b61ef6a 100755
--- a/Source/cmparseMSBuildXML.py
+++ b/Source/cmparseMSBuildXML.py
@@ -9,6 +9,9 @@
 #  "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/cl.xml"
 #  "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/lib.xml"
 #  "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/link.xml"
+#  "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/cl.xml"
+#  "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/lib.xml"
+#  "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/link.xml"
 #
 #  BoolProperty  <Name>true|false</Name>
 #   simple example:
diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt
index 20001e6ed..69cfdb8e3 100644
--- a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt
+++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt
@@ -37,6 +37,9 @@ endif()
 if(DEFINED MSVC11)
   math(EXPR msvc_total "${msvc_total} + 1")
 endif()
+if(DEFINED MSVC12)
+  math(EXPR msvc_total "${msvc_total} + 1")
+endif()
 
 echo_var(MSVC)
 echo_var(MSVC60)
@@ -46,6 +49,7 @@ echo_var(MSVC80)
 echo_var(MSVC90)
 echo_var(MSVC10)
 echo_var(MSVC11)
+echo_var(MSVC12)
 echo_var(MSVC_IDE)
 
 if(MSVC)
diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt
index 78746e7b8..ad119cc68 100644
--- a/Tests/Preprocess/CMakeLists.txt
+++ b/Tests/Preprocess/CMakeLists.txt
@@ -40,6 +40,9 @@ endif()
 if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 11")
   set(PP_VS110 1)
 endif()
+if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 12")
+  set(PP_VS120 1)
+endif()
 
 # Some tests below check the PP_* variables set above.  They are meant
 # to test the case that the build tool is at fault.  Other tests below
@@ -55,7 +58,8 @@ endif()
 # must not have it escaped inside the configured header.
 set(STRING_EXTRA "")
 
-if(NOT BORLAND AND NOT PP_VS70 AND NOT PP_VS100 AND NOT PP_VS110)
+if(NOT BORLAND AND NOT PP_VS70
+    AND NOT PP_VS100 AND NOT PP_VS110 AND NOT PP_VS120)
   # Borland, VS70 IDE: ;
   # The Borland compiler will simply not accept a non-escaped semicolon
   # on the command line.  If it is escaped \; then the escape character
diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
index 09375d9a7..1ccc1adb2 100644
--- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
@@ -3,7 +3,7 @@ include(RunCMake)
 set(RunCMake_GENERATOR_TOOLSET "")
 run_cmake(NoToolset)
 
-if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01]|Xcode" AND NOT XCODE_BELOW_3)
+if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012]|Xcode" AND NOT XCODE_BELOW_3)
   set(RunCMake_GENERATOR_TOOLSET "Test Toolset")
   run_cmake(TestToolset)
 else()
diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt
index 5ce15e05d..8fc287145 100644
--- a/Tests/VSExternalInclude/CMakeLists.txt
+++ b/Tests/VSExternalInclude/CMakeLists.txt
@@ -6,7 +6,7 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
 else()
   set(PROJECT_EXT vcproj)
 endif()
-if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01]")
+if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012]")
   set(PROJECT_EXT vcxproj)
 endif()
 
@@ -54,7 +54,7 @@ add_dependencies(VSExternalInclude lib2)
 # and the sln file can no longer be the only source
 # of that depend.  So, for VS 10 make the executable
 # depend on lib1 and lib2
-if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01]")
+if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012]")
   add_dependencies(VSExternalInclude lib1)
 endif()
 
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index ef000a16a..320612cf6 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -376,7 +376,6 @@ MARK_AS_ADVANCED(RANDOM_FILE)
 #sigaction \
 #signal \
 #getpass_r \
-#strlcat \
 #getpwuid \
 #geteuid \
 #dlopen \
@@ -428,7 +427,6 @@ CHECK_SYMBOL_EXISTS(closesocket   "${CURL_INCLUDES}" HAVE_CLOSESOCKET)
 CHECK_SYMBOL_EXISTS(setvbuf       "${CURL_INCLUDES}" HAVE_SETVBUF)
 CHECK_SYMBOL_EXISTS(sigsetjmp     "${CURL_INCLUDES}" HAVE_SIGSETJMP)
 CHECK_SYMBOL_EXISTS(getpass_r     "${CURL_INCLUDES}" HAVE_GETPASS_R)
-CHECK_SYMBOL_EXISTS(strlcat       "${CURL_INCLUDES}" HAVE_STRLCAT)
 CHECK_SYMBOL_EXISTS(getpwuid      "${CURL_INCLUDES}" HAVE_GETPWUID)
 CHECK_SYMBOL_EXISTS(geteuid       "${CURL_INCLUDES}" HAVE_GETEUID)
 CHECK_SYMBOL_EXISTS(utime         "${CURL_INCLUDES}" HAVE_UTIME)
diff --git a/Utilities/cmcurl/Platforms/WindowsCache.cmake b/Utilities/cmcurl/Platforms/WindowsCache.cmake
index b4515ce04..57ab30be3 100644
--- a/Utilities/cmcurl/Platforms/WindowsCache.cmake
+++ b/Utilities/cmcurl/Platforms/WindowsCache.cmake
@@ -76,7 +76,6 @@ IF(NOT UNIX)
     SET(HAVE_SETVBUF 0)
     SET(HAVE_SIGSETJMP 0)
     SET(HAVE_GETPASS_R 0)
-    SET(HAVE_STRLCAT 0)
     SET(HAVE_GETPWUID 0)
     SET(HAVE_GETEUID 0)
     SET(HAVE_UTIME 1)
diff --git a/Utilities/cmcurl/Platforms/config-aix.h b/Utilities/cmcurl/Platforms/config-aix.h
index 86d10938f..c98b10fdd 100644
--- a/Utilities/cmcurl/Platforms/config-aix.h
+++ b/Utilities/cmcurl/Platforms/config-aix.h
@@ -343,9 +343,6 @@
 /* Define to 1 if you have the <string.h> header file. */
 #define HAVE_STRING_H 1
 
-/* Define to 1 if you have the `strlcat' function. */
-/* #undef HAVE_STRLCAT */
-
 /* Define to 1 if you have the `strlcpy' function. */
 /* #undef HAVE_STRLCPY */
 
diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in
index e18af8ffe..148722b2f 100644
--- a/Utilities/cmcurl/config.h.in
+++ b/Utilities/cmcurl/config.h.in
@@ -441,9 +441,6 @@
 /* Define to 1 if you have the <string.h> header file. */
 #cmakedefine HAVE_STRING_H ${HAVE_STRING_H}
 
-/* Define to 1 if you have the `strlcat' function. */
-#cmakedefine HAVE_STRLCAT ${HAVE_STRLCAT}
-
 /* Define to 1 if you have the `strlcpy' function. */
 #cmakedefine HAVE_STRLCPY ${HAVE_STRLCPY}
 
diff --git a/Utilities/cmcurl/socks.c b/Utilities/cmcurl/socks.c
index 3319e697e..e0e947b80 100644
--- a/Utilities/cmcurl/socks.c
+++ b/Utilities/cmcurl/socks.c
@@ -199,8 +199,15 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
    * This is currently not supporting "Identification Protocol (RFC1413)".
    */
   socksreq[8] = 0; /* ensure empty userid is NUL-terminated */
-  if (proxy_name)
-    strlcat((char*)socksreq + 8, proxy_name, sizeof(socksreq) - 8);
+  if(proxy_name) {
+    size_t plen = strlen(proxy_name);
+    if(plen >= sizeof(socksreq) - 8) {
+      failf(data, "Too long SOCKS proxy name, can't use!\n");
+      return CURLE_COULDNT_CONNECT;
+    }
+    /* copy the proxy name WITH trailing zero */
+    memcpy(socksreq + 8, proxy_name, plen+1);
+  }
 
   /*
    * Make connection
diff --git a/Utilities/cmcurl/strequal.c b/Utilities/cmcurl/strequal.c
index 76ad5241f..83796f667 100644
--- a/Utilities/cmcurl/strequal.c
+++ b/Utilities/cmcurl/strequal.c
@@ -99,45 +99,3 @@ char *Curl_strcasestr(const char *haystack, const char *needle)
   }
   return NULL;
 }
-
-#ifndef HAVE_STRLCAT
-/*
- * The strlcat() function appends the NUL-terminated string src to the end
- * of dst. It will append at most size - strlen(dst) - 1 bytes, NUL-termi-
- * nating the result.
- *
- * The strlcpy() and strlcat() functions return the total length of the
- * string they tried to create.  For strlcpy() that means the length of src.
- * For strlcat() that means the initial length of dst plus the length of
- * src. While this may seem somewhat confusing it was done to make trunca-
- * tion detection simple.
- *
- *
- */
-size_t Curl_strlcat(char *dst, const char *src, size_t siz)
-{
-  char *d = dst;
-  const char *s = src;
-  size_t n = siz;
-  size_t dlen;
-
-  /* Find the end of dst and adjust bytes left but don't go past end */
-  while (n-- != 0 && *d != '\0')
-    d++;
-  dlen = d - dst;
-  n = siz - dlen;
-
-  if (n == 0)
-    return(dlen + strlen(s));
-  while (*s != '\0') {
-    if (n != 1) {
-      *d++ = *s;
-      n--;
-    }
-    s++;
-  }
-  *d = '\0';
-
-  return(dlen + (s - src));     /* count does not include NUL */
-}
-#endif
diff --git a/Utilities/cmcurl/strequal.h b/Utilities/cmcurl/strequal.h
index b3caa7345..6718c3c0e 100644
--- a/Utilities/cmcurl/strequal.h
+++ b/Utilities/cmcurl/strequal.h
@@ -35,9 +35,4 @@
 /* case insensitive strstr() */
 char *Curl_strcasestr(const char *haystack, const char *needle);
 
-#ifndef HAVE_STRLCAT
-#define strlcat(x,y,z) Curl_strlcat(x,y,z)
-#endif
-size_t strlcat(char *dst, const char *src, size_t siz);
-
 #endif