From d639620e14cb25a3bc8039bc2a50bf402b8d2f79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roman=20W=C3=BCger?= <roman.wueger@gmx.at>
Date: Tue, 29 Nov 2016 13:50:21 +0100
Subject: VS: Rename VS 15 generator to 'Visual Studio 15 2017'

The final name of this VS version was announced:

 https://blogs.msdn.microsoft.com/visualstudio/2016/11/16/visual-studio-2017-rc/

Add the year to the generator name accordingly.  For convenience, map
the name without the year to the name with the year.
---
 Help/generator/Visual Studio 15 2017.rst   | 16 ++++++++++++++++
 Help/generator/Visual Studio 15.rst        | 16 ----------------
 Help/manual/cmake-generators.7.rst         |  2 +-
 Help/release/3.7.rst                       |  6 +++---
 Source/cmGlobalVisualStudio15Generator.cxx | 11 +++++++----
 Source/cmake.cxx                           |  2 +-
 6 files changed, 28 insertions(+), 25 deletions(-)
 create mode 100644 Help/generator/Visual Studio 15 2017.rst
 delete mode 100644 Help/generator/Visual Studio 15.rst

diff --git a/Help/generator/Visual Studio 15 2017.rst b/Help/generator/Visual Studio 15 2017.rst
new file mode 100644
index 0000000..18b0131
--- /dev/null
+++ b/Help/generator/Visual Studio 15 2017.rst	
@@ -0,0 +1,16 @@
+Visual Studio 15 2017
+---------------------
+
+Generates Visual Studio 15 (VS 2017) project files.
+
+The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
+to specify a target platform name (architecture).
+
+For compatibility with CMake versions prior to 3.1, one may specify
+a target platform name optionally at the end of this generator name:
+
+``Visual Studio 15 2017 Win64``
+  Specify target platform ``x64``.
+
+``Visual Studio 15 2017 ARM``
+  Specify target platform ``ARM``.
diff --git a/Help/generator/Visual Studio 15.rst b/Help/generator/Visual Studio 15.rst
deleted file mode 100644
index ae456eb..0000000
--- a/Help/generator/Visual Studio 15.rst	
+++ /dev/null
@@ -1,16 +0,0 @@
-Visual Studio 15
-----------------
-
-Generates Visual Studio 15 project files.
-
-The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
-to specify a target platform name (architecture).
-
-For compatibility with CMake versions prior to 3.1, one may specify
-a target platform name optionally at the end of this generator name:
-
-``Visual Studio 15 Win64``
-  Specify target platform ``x64``.
-
-``Visual Studio 15 ARM``
-  Specify target platform ``ARM``.
diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst
index 3df3a81..a37c65b 100644
--- a/Help/manual/cmake-generators.7.rst
+++ b/Help/manual/cmake-generators.7.rst
@@ -82,7 +82,7 @@ Visual Studio Generators
    /generator/Visual Studio 11 2012
    /generator/Visual Studio 12 2013
    /generator/Visual Studio 14 2015
-   /generator/Visual Studio 15
+   /generator/Visual Studio 15 2017
 
 Other Generators
 ^^^^^^^^^^^^^^^^
diff --git a/Help/release/3.7.rst b/Help/release/3.7.rst
index 3b8ade6..4c51af4 100644
--- a/Help/release/3.7.rst
+++ b/Help/release/3.7.rst
@@ -31,9 +31,9 @@ Generators
   This is equivalent to ``cd sub/dir; make {test,install,package}``
   with :ref:`Makefile Generators`.
 
-* The :generator:`Visual Studio 15` generator was added.  This is
-  experimental and based on Preview 5 because this version of VS
-  has not been released.
+* The :generator:`Visual Studio 15 2017` generator was added.  This is
+  experimental and based on "Visual Studio 2017 RC" because this version
+  of VS has not been released.
 
 * :ref:`Visual Studio Generators` for VS 2010 and above learned to
   place ``.natvis`` source files into VS project files properly.
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx
index a833a5f..0c6beb2 100644
--- a/Source/cmGlobalVisualStudio15Generator.cxx
+++ b/Source/cmGlobalVisualStudio15Generator.cxx
@@ -6,16 +6,19 @@
 #include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
 
-static const char vs15generatorName[] = "Visual Studio 15";
+static const char vs15generatorName[] = "Visual Studio 15 2017";
 
 // Map generator name without year to name with year.
 static const char* cmVS15GenName(const std::string& name, std::string& genName)
 {
   if (strncmp(name.c_str(), vs15generatorName,
-              sizeof(vs15generatorName) - 1) != 0) {
+              sizeof(vs15generatorName) - 6) != 0) {
     return 0;
   }
-  const char* p = name.c_str() + sizeof(vs15generatorName) - 1;
+  const char* p = name.c_str() + sizeof(vs15generatorName) - 6;
+  if (cmHasLiteralPrefix(p, " 2017")) {
+    p += 5;
+  }
   genName = std::string(vs15generatorName) + p;
   return p;
 }
@@ -50,7 +53,7 @@ public:
   virtual void GetDocumentation(cmDocumentationEntry& entry) const
   {
     entry.Name = std::string(vs15generatorName) + " [arch]";
-    entry.Brief = "Generates Visual Studio 15 project files.  "
+    entry.Brief = "Generates Visual Studio 2017 project files.  "
                   "Optional [arch] can be \"Win64\" or \"ARM\".";
   }
 
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index c8cf465..f0caf0d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1334,7 +1334,7 @@ int cmake::ActualConfigure()
         { "11.0", "Visual Studio 11 2012" },
         { "12.0", "Visual Studio 12 2013" },
         { "14.0", "Visual Studio 14 2015" },
-        { "15.0", "Visual Studio 15" },
+        { "15.0", "Visual Studio 15 2017" },
         { 0, 0 }
       };
       for (int i = 0; version[i].MSVersion != 0; i++) {
-- 
cgit v0.12