diff options
author | Brad King <brad.king@kitware.com> | 2023-02-08 16:49:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-02-08 16:49:27 (GMT) |
commit | d7f440c5dbe787ccf96da490ad813a897c146498 (patch) | |
tree | f6ff1215509899d6d17dbca52eb23cad65a37b32 | |
parent | 507dcaf5639c8a3e0ae4aeb2792b6926861aebd3 (diff) | |
download | CMake-d7f440c5dbe787ccf96da490ad813a897c146498.zip CMake-d7f440c5dbe787ccf96da490ad813a897c146498.tar.gz CMake-d7f440c5dbe787ccf96da490ad813a897c146498.tar.bz2 |
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.
-rw-r--r-- | Help/generator/Visual Studio 9 2008.rst | 10 | ||||
-rw-r--r-- | Help/release/dev/vs9-deprecate.rst | 5 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 20 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio9Generator.cxx | 2 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/EnforceConfig.cmake.in | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/DeprecateVS9-WARN-OFF.cmake | 0 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/DeprecateVS9-WARN-ON-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/DeprecateVS9-WARN-ON.cmake | 0 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 7 |
10 files changed, 53 insertions, 6 deletions
diff --git a/Help/generator/Visual Studio 9 2008.rst b/Help/generator/Visual Studio 9 2008.rst index 3434956..816969d 100644 --- a/Help/generator/Visual Studio 9 2008.rst +++ b/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 ^^^^^^^^^^^^^^^^^^ diff --git a/Help/release/dev/vs9-deprecate.rst b/Help/release/dev/vs9-deprecate.rst new file mode 100644 index 0000000..46568f8 --- /dev/null +++ b/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. diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index d483135..5de3a55 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/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; diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 9f6550b..e396405 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/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\"." }; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c22f704..38e0460 100644 --- a/Tests/CMakeLists.txt +++ b/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 diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in index 7722d7d..61be40b 100644 --- a/Tests/EnforceConfig.cmake.in +++ b/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@ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS9-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS9-WARN-OFF.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS9-WARN-OFF.cmake diff --git a/Tests/RunCMake/CommandLine/DeprecateVS9-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS9-WARN-ON-stderr.txt new file mode 100644 index 0000000..c3329a0 --- /dev/null +++ b/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.$ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS9-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS9-WARN-ON.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS9-WARN-ON.cmake diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f48e845..718a2a1 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/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}) |