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.
This commit is contained in:
Brad King
2023-02-08 11:49:27 -05:00
parent 507dcaf563
commit d7f440c5db
10 changed files with 53 additions and 6 deletions

View File

@@ -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
^^^^^^^^^^^^^^^^^^

View File

@@ -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.

View File

@@ -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;

View File

@@ -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\"." };
}

View File

@@ -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

View File

@@ -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@

View File

@@ -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.$

View File

@@ -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})