Browse Source

Deprecate Visual Studio 9 2008 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 years ago
parent
commit
d7f440c5db

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

@@ -1,7 +1,15 @@
 Visual Studio 9 2008
 --------------------
 
-Generates Visual Studio 9 2008 project files.
+Deprecated.  Generates Visual Studio 9 2008 project files.
+
+.. note::
+  This generator is deprecated and will be removed in a future version
+  of CMake.  It will still be possible to build with VS 9 2008 tools
+  using the :generator:`Visual Studio 12 2013` generator (or above,
+  and with VS 10 2010 also installed) with
+  :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v90``,
+  or by using the :generator:`NMake Makefiles` generator.
 
 Platform Selection
 ^^^^^^^^^^^^^^^^^^

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

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

+ 20 - 0
Source/cmGlobalVisualStudio7Generator.cxx

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

+ 1 - 1
Source/cmGlobalVisualStudio9Generator.cxx

@@ -64,7 +64,7 @@ public:
   cmDocumentationEntry GetDocumentation() const override
   {
     return { std::string(vs9generatorName) + " [arch]",
-             "Generates Visual Studio 2008 project files.  "
+             "Deprecated.  Generates Visual Studio 2008 project files.  "
              "Optional [arch] can be \"Win64\" or \"IA64\"." };
   }
 

+ 5 - 3
Tests/CMakeLists.txt

@@ -40,10 +40,12 @@ set(ENV{HOME} \"${TEST_HOME}\")
 endif()
 
 # Suppress generator deprecation warnings in test suite.
-if(CMAKE_GENERATOR MATCHES "^Visual Studio 11 2012")
-  set(TEST_WARN_VS11_CODE "set(ENV{CMAKE_WARN_VS11} OFF)")
+if(CMAKE_GENERATOR MATCHES "^Visual Studio 9 2008")
+  set(TEST_WARN_VS_CODE "set(ENV{CMAKE_WARN_VS9} OFF)")
+elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 11 2012")
+  set(TEST_WARN_VS_CODE "set(ENV{CMAKE_WARN_VS11} OFF)")
 else()
-  set(TEST_WARN_VS11_CODE "")
+  set(TEST_WARN_VS_CODE "")
 endif()
 
 # 3.9 or later provides a definitive answer to whether we are multi-config

+ 1 - 1
Tests/EnforceConfig.cmake.in

@@ -36,4 +36,4 @@ unset(ENV{CMAKE_GENERATOR_TOOLSET})
 unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS})
 
 @TEST_HOME_ENV_CODE@
-@TEST_WARN_VS11_CODE@
+@TEST_WARN_VS_CODE@

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


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

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

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


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

@@ -1100,6 +1100,13 @@ set(RunCMake_TEST_OPTIONS --profiling-format=google-trace --profiling-output=${P
 run_cmake(ProfilingTest)
 unset(RunCMake_TEST_OPTIONS)
 
+if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 2008")
+  run_cmake_with_options(DeprecateVS9-WARN-ON -DCMAKE_WARN_VS9=ON)
+  unset(ENV{CMAKE_WARN_VS9})
+  run_cmake(DeprecateVS9-WARN-ON)
+  run_cmake_with_options(DeprecateVS9-WARN-OFF -DCMAKE_WARN_VS9=OFF)
+endif()
+
 if(RunCMake_GENERATOR MATCHES "^Visual Studio 11 2012")
   run_cmake_with_options(DeprecateVS11-WARN-ON -DCMAKE_WARN_VS11=ON)
   unset(ENV{CMAKE_WARN_VS11})