diff --git a/Help/generator/Visual Studio 10 2010.rst b/Help/generator/Visual Studio 10 2010.rst index c065550361d3f71dc32d757ddced5ffaaefa87bb..9ec33c3549e6a4219ba087f823e97573c31d5b9e 100644 --- a/Help/generator/Visual Studio 10 2010.rst +++ b/Help/generator/Visual Studio 10 2010.rst @@ -1,7 +1,14 @@ Visual Studio 10 2010 --------------------- -Generates Visual Studio 10 (VS 2010) project files. +Deprecated. Generates Visual Studio 10 (VS 2010) 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 10 2010 tools + using the :generator:`Visual Studio 11 2012` (or above) generator + with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v100``, or by + using the :generator:`NMake Makefiles` generator. For compatibility with CMake versions prior to 3.0, one may specify this generator using the name ``Visual Studio 10`` without the year component. diff --git a/Help/release/dev/vs10-deprecate.rst b/Help/release/dev/vs10-deprecate.rst new file mode 100644 index 0000000000000000000000000000000000000000..7bec3911545a0725a5533d9cf30ed13184e9b92c --- /dev/null +++ b/Help/release/dev/vs10-deprecate.rst @@ -0,0 +1,5 @@ +vs10-deprecate +-------------- + +* The :generator:`Visual Studio 10 2010` generator is now deprecated + and will be removed in a future version of CMake. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index fdb71554ce1bc68c2234bc01168db1d905962476..488ff2e9c7a2ce953e6c4198b4243a74c4024f5c 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -88,7 +88,7 @@ public: void GetDocumentation(cmDocumentationEntry& entry) const override { entry.Name = std::string(vs10generatorName) + " [arch]"; - entry.Brief = "Generates Visual Studio 2010 project files. " + entry.Brief = "Deprecated. Generates Visual Studio 2010 project files. " "Optional [arch] can be \"Win64\" or \"IA64\"."; } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index f8aa1729e4ca7c95ed705118a981747985a06923..34dba1eb5c26cf52e3e7de69ffcd790ed863dade 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -296,6 +296,25 @@ void cmGlobalVisualStudio7Generator::Generate() this->CallVisualStudioMacro(MacroReload, GetSLNFile(this->LocalGenerators[0].get())); } + + if (this->Version == VS10 && !this->CMakeInstance->GetIsInTryCompile()) { + std::string cmakeWarnVS10; + if (cmProp cached = this->CMakeInstance->GetState()->GetCacheEntryValue( + "CMAKE_WARN_VS10")) { + this->CMakeInstance->MarkCliAsUsed("CMAKE_WARN_VS10"); + cmakeWarnVS10 = *cached; + } else { + cmSystemTools::GetEnv("CMAKE_WARN_VS10", cmakeWarnVS10); + } + if (cmakeWarnVS10.empty() || !cmIsOff(cmakeWarnVS10)) { + this->CMakeInstance->IssueMessage( + MessageType::WARNING, + "The \"Visual Studio 10 2010\" generator is deprecated " + "and will be removed in a future version of CMake." + "\n" + "Add CMAKE_WARN_VS10=OFF to the cache to disable this warning."); + } + } } void cmGlobalVisualStudio7Generator::OutputSLNFile( diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 388ff207a814fbafc22440397df9f06afe2839e9..ef8c84648c502dcc4e86fdd27a0c1b2e3b8df715 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -39,6 +39,13 @@ set(ENV{HOME} \"${TEST_HOME}\") ") endif() +# Suppress generator deprecation warnings in test suite. +if(CMAKE_GENERATOR MATCHES "^Visual Studio 10 2010") + set(TEST_WARN_VS10_CODE "set(ENV{CMAKE_WARN_VS10} OFF)") +else() + set(TEST_WARN_VS10_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 diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in index 7781ded84a770cd9efea53a9f14f5623d9c31577..7c6f76a24a7b83305b9fb9cb3f71c8b8a4b51536 100644 --- a/Tests/EnforceConfig.cmake.in +++ b/Tests/EnforceConfig.cmake.in @@ -36,3 +36,4 @@ unset(ENV{CMAKE_GENERATOR_TOOLSET}) unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS}) @TEST_HOME_ENV_CODE@ +@TEST_WARN_VS10_CODE@ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-OFF.cmake new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON-stderr.txt new file mode 100644 index 0000000000000000000000000000000000000000..202ef80b61a9f20cd2d2fadcb9db7195b84ee593 --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning: + The "Visual Studio 10 2010" generator is deprecated and will be removed in + a future version of CMake. + + Add CMAKE_WARN_VS10=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON.cmake new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 0b26b89012446f5632246567fbe576b23bda3962..cea5b1b1f7311990447467b2dd33f7a8442c75f2 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -918,3 +918,10 @@ set(ProfilingTestOutput ${RunCMake_TEST_BINARY_DIR}/output.json) set(RunCMake_TEST_OPTIONS --profiling-format=google-trace --profiling-output=${ProfilingTestOutput}) run_cmake(ProfilingTest) unset(RunCMake_TEST_OPTIONS) + +if(RunCMake_GENERATOR MATCHES "^Visual Studio 10 2010") + run_cmake_with_options(DeprecateVS10-WARN-ON -DCMAKE_WARN_VS10=ON) + unset(ENV{CMAKE_WARN_VS10}) + run_cmake(DeprecateVS10-WARN-ON) + run_cmake_with_options(DeprecateVS10-WARN-OFF -DCMAKE_WARN_VS10=OFF) +endif()