Forráskód Böngészése

Deprecate Visual Studio 14 2015 generator

Update documentation to mark the generator deprecated.  Add a warning at
the end of generation plus an option to turn off the warning.
Brad King 3 hónapja
szülő
commit
b10daadd08

+ 2 - 2
Help/generator/Visual Studio 10 2010.rst

@@ -3,7 +3,7 @@ Visual Studio 10 2010
 
 Removed.  This once generated Visual Studio 10 2010 project files, but
 the generator has been removed since CMake 3.25.  It is still possible
-to build with the VS 10 2010 toolset by also installing VS 2015 (or above)
-and using the :generator:`Visual Studio 14 2015` (or above) generator with
+to build with the VS 10 2010 toolset by also installing VS 2017 (or above)
+and using the :generator:`Visual Studio 15 2017` (or above) generator with
 :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v100``,
 or by using the :generator:`NMake Makefiles` generator.

+ 2 - 2
Help/generator/Visual Studio 11 2012.rst

@@ -3,7 +3,7 @@ Visual Studio 11 2012
 
 Removed.  This once generated Visual Studio 11 2012 project files, but
 the generator has been removed since CMake 3.28.  It is still possible
-to build with the VS 11 2012 toolset by also installing VS 2015 (or above)
-and using the :generator:`Visual Studio 14 2015` (or above) generator with
+to build with the VS 11 2012 toolset by also installing VS 2017 (or above)
+and using the :generator:`Visual Studio 15 2017` (or above) generator with
 :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v110``,
 or by using the :generator:`NMake Makefiles` generator.

+ 2 - 2
Help/generator/Visual Studio 12 2013.rst

@@ -3,7 +3,7 @@ Visual Studio 12 2013
 
 Removed.  This once generated Visual Studio 12 2013 project files, but
 the generator has been removed since CMake 3.31.  It is still possible
-to build with the VS 12 2013 toolset by also installing VS 2015 (or above)
-and using the :generator:`Visual Studio 14 2015` (or above) generator with
+to build with the VS 12 2013 toolset by also installing VS 2017 (or above)
+and using the :generator:`Visual Studio 15 2017` (or above) generator with
 :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v120``,
 or by using the :generator:`NMake Makefiles` generator.

+ 8 - 0
Help/generator/Visual Studio 14 2015.rst

@@ -1,6 +1,14 @@
 Visual Studio 14 2015
 ---------------------
 
+.. deprecated:: 4.2
+
+  This generator is deprecated and will be removed in a future version
+  of CMake.  It will still be possible to build with VS 14 2015 tools
+  using the :generator:`Visual Studio 15 2017` (or above) generator
+  with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v140``, or by
+  using the :generator:`NMake Makefiles` generator.
+
 .. versionadded:: 3.1
 
 Generates Visual Studio 14 (VS 2015) project files.

+ 1 - 1
Help/generator/Visual Studio 9 2008.rst

@@ -4,6 +4,6 @@ Visual Studio 9 2008
 Removed.  This once generated Visual Studio 9 2008 project files, but
 the generator has been removed since CMake 3.30.  It is still possible
 to build with the VS 9 2008 toolset by also installing VS 10 2010 and
-VS 2015 (or above) and using the :generator:`Visual Studio 14 2015`
+VS 2017 (or above) and using the :generator:`Visual Studio 15 2017`
 generator (or above) with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v90``,
 or by using the :generator:`NMake Makefiles` generator.

+ 5 - 0
Help/release/dev/vs14-deprecate.rst

@@ -0,0 +1,5 @@
+vs14-deprecate
+--------------
+
+* The :generator:`Visual Studio 14 2015` generator is now deprecated
+  and will be removed in a future version of CMake.

+ 1 - 1
Source/cmGlobalVisualStudio14Generator.cxx

@@ -57,7 +57,7 @@ public:
   cmDocumentationEntry GetDocumentation() const override
   {
     return { std::string(vs14generatorName),
-             "Generates Visual Studio 2015 project files.  "
+             "Deprecated.  Generates Visual Studio 2015 project files.  "
              "Use -A option to specify architecture." };
   }
 

+ 20 - 0
Source/cmGlobalVisualStudio7Generator.cxx

@@ -308,6 +308,26 @@ void cmGlobalVisualStudio7Generator::Generate()
     this->CallVisualStudioMacro(MacroReload,
                                 GetSLNFile(this->LocalGenerators[0].get()));
   }
+
+  if (this->Version == VSVersion::VS14 &&
+      !this->CMakeInstance->GetIsInTryCompile()) {
+    std::string cmakeWarnVS14;
+    if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue(
+          "CMAKE_WARN_VS14")) {
+      this->CMakeInstance->MarkCliAsUsed("CMAKE_WARN_VS14");
+      cmakeWarnVS14 = *cached;
+    } else {
+      cmSystemTools::GetEnv("CMAKE_WARN_VS14", cmakeWarnVS14);
+    }
+    if (cmakeWarnVS14.empty() || !cmIsOff(cmakeWarnVS14)) {
+      this->CMakeInstance->IssueMessage(
+        MessageType::WARNING,
+        "The \"Visual Studio 14 2015\" generator is deprecated "
+        "and will be removed in a future version of CMake."
+        "\n"
+        "Add CMAKE_WARN_VS14=OFF to the cache to disable this warning.");
+    }
+  }
 }
 
 void cmGlobalVisualStudio7Generator::OutputSLNFile(

+ 7 - 0
Tests/CMakeLists.txt

@@ -50,6 +50,13 @@ set(ENV{HOME} \"${TEST_HOME}\")
 ")
 endif()
 
+# Suppress generator deprecation warnings in test suite.
+if(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015")
+  set(TEST_WARN_VS_CODE "set(ENV{CMAKE_WARN_VS14} OFF)")
+else()
+  set(TEST_WARN_VS_CODE "")
+endif()
+
 # 3.9 or later provides a definitive answer to whether we are multi-config
 # through a global property. Prior to 3.9, CMAKE_CONFIGURATION_TYPES being set
 # is assumed to mean multi-config, but developers might modify it so it is

+ 0 - 0
Tests/RunCMake/CommandLine/DeprecateVS14-WARN-OFF.cmake


+ 5 - 0
Tests/RunCMake/CommandLine/DeprecateVS14-WARN-ON-stderr.txt

@@ -0,0 +1,5 @@
+^CMake Warning:
+  The "Visual Studio 14 2015" generator is deprecated and will be removed in
+  a future version of CMake.
+
+  Add CMAKE_WARN_VS14=OFF to the cache to disable this warning.$

+ 0 - 0
Tests/RunCMake/CommandLine/DeprecateVS14-WARN-ON.cmake


+ 7 - 0
Tests/RunCMake/CommandLine/RunCMakeTest.cmake

@@ -1167,3 +1167,10 @@ if (WIN32 OR DEFINED ENV{HOME})
 endif()
 set(ENV{CMAKE_CONFIG_DIR} cmake_config_dir)
 run_cmake_command(print-config-dir-env ${CMAKE_COMMAND} "--print-config-dir")
+
+if(RunCMake_GENERATOR MATCHES "^Visual Studio 14 2015")
+  run_cmake_with_options(DeprecateVS14-WARN-ON -DCMAKE_WARN_VS14=ON)
+  unset(ENV{CMAKE_WARN_VS14})
+  run_cmake(DeprecateVS14-WARN-ON)
+  run_cmake_with_options(DeprecateVS14-WARN-OFF -DCMAKE_WARN_VS14=OFF)
+endif()