1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

CMakeDetermineVSServicePack: Add policy to remove this module

It has been documented as deprecated since CMake 3.0.
This commit is contained in:
Brad King
2025-05-28 09:41:34 -04:00
parent 9ffbef62ca
commit 39da33ae81
16 changed files with 93 additions and 1 deletions

View File

@@ -98,6 +98,7 @@ Policies Introduced by CMake 4.1
.. toctree::
:maxdepth: 1
CMP0196: The CMakeDetermineVSServicePack module is removed. </policy/CMP0196>
CMP0195: Swift modules in build trees use the Swift module directory structure. </policy/CMP0195>
CMP0194: MSVC is not an assembler for language ASM. </policy/CMP0194>
CMP0193: GNUInstallDirs caches CMAKE_INSTALL_* with leading 'usr/' for install prefix '/'. </policy/CMP0193>

23
Help/policy/CMP0196.rst Normal file
View File

@@ -0,0 +1,23 @@
CMP0196
-------
.. versionadded:: 4.1
The :module:`CMakeDetermineVSServicePack` module is removed.
The ``CMakeDetermineVSServicePack`` module has long been superseded by
the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable, and the module
has been documented as deprecated since CMake 3.0. CMake 4.1 and above
prefer to not provide the module. This policy provides compatibility
for projects that have not been ported away from it.
The ``OLD`` behavior of this policy is for
``include(CMakeDetermineVSServicePack)`` to load the deprecated module.
The ``NEW`` behavior halts with a fatal error if anything tries to include
the module.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.1
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: include/STANDARD_ADVICE.rst
.. include:: include/DEPRECATED.rst

View File

@@ -0,0 +1,6 @@
remove-CMakeDetermineVSServicePack
----------------------------------
* The :module`:CMakeDetermineVSServicePack` module has been deprecated
via policy :policy:`CMP0196`. Port projects to the
:variable:`CMAKE_<LANG>_COMPILER_VERSION` variable instead.

View File

@@ -5,6 +5,10 @@
CMakeDetermineVSServicePack
---------------------------
.. versionchanged:: 4.1
This module is available only if policy :policy:`CMP0196` is not set to ``NEW``.
.. deprecated:: 3.0
This module should no longer be used. The functionality of this module has
@@ -59,6 +63,16 @@ Determining the Visual Studio service pack version in a project:
endif()
#]=======================================================================]
cmake_policy(GET CMP0196 _CMakeDetermineVSServicePack_CMP0196)
if(_CMakeDetermineVSServicePack_CMP0196 STREQUAL "NEW")
message(FATAL_ERROR "The CMakeDetermineVSServicePack module has been removed by policy CMP0196.")
endif()
if(_CMakeDetermineVSServicePack_testing)
set(_CMakeDetermineVSServicePack_included TRUE)
return()
endif()
if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8)
message(DEPRECATION
"This module is deprecated and should not be used. "

View File

@@ -19,6 +19,7 @@ bool cmIncludeCommand(std::vector<std::string> const& args,
{
static std::map<std::string, cmPolicies::PolicyID> DeprecatedModules;
if (DeprecatedModules.empty()) {
DeprecatedModules["CMakeDetermineVSServicePack"] = cmPolicies::CMP0196;
DeprecatedModules["CMakeFindFrameworks"] = cmPolicies::CMP0173;
DeprecatedModules["Dart"] = cmPolicies::CMP0145;
DeprecatedModules["Documentation"] = cmPolicies::CMP0106;

View File

@@ -584,7 +584,9 @@ class cmMakefile;
SELECT( \
POLICY, CMP0195, \
"Swift modules in build trees use the Swift module directory structure.", \
4, 1, 0, WARN)
4, 1, 0, WARN) \
SELECT(POLICY, CMP0196, \
"The CMakeDetermineVSServicePack module is removed.", 4, 1, 0, WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,6 @@
^CMake Error at CMP0196-NEW-name\.cmake:[0-9]+ \(include\):
include could not find requested file:
CMakeDetermineVSServicePack
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)$

View File

@@ -0,0 +1,2 @@
cmake_policy(SET CMP0196 NEW)
include(CMakeDetermineVSServicePack)

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,6 @@
^CMake Error at [^
]*/Modules/CMakeDetermineVSServicePack.cmake:[0-9]+ \(message\):
The CMakeDetermineVSServicePack module has been removed by policy CMP0196\.
Call Stack \(most recent call first\):
CMP0196-NEW-path\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)$

View File

@@ -0,0 +1,2 @@
cmake_policy(SET CMP0196 NEW)
include(${CMAKE_ROOT}/Modules/CMakeDetermineVSServicePack.cmake)

View File

@@ -0,0 +1,7 @@
cmake_policy(SET CMP0196 OLD)
set(_CMakeDetermineVSServicePack_testing 1)
include(CMakeDetermineVSServicePack)
if(NOT _CMakeDetermineVSServicePack_included)
message(FATAL_ERROR "CMakeDetermineVSServicePack.cmake not included")
endif()

View File

@@ -0,0 +1,8 @@
^CMake Warning \(dev\) at CMP0196-WARN\.cmake:[0-9]+ \(include\):
Policy CMP0196 is not set: The CMakeDetermineVSServicePack module is
removed\. Run "cmake --help-policy CMP0196" for policy details\. Use the
cmake_policy command to set the policy and suppress this warning\.
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
This warning is for project developers\. Use -Wno-dev to suppress it\.$

View File

@@ -0,0 +1,7 @@
# Do not set CMP0196.
set(_CMakeDetermineVSServicePack_testing 1)
include(CMakeDetermineVSServicePack)
if(NOT _CMakeDetermineVSServicePack_included)
message(FATAL_ERROR "CMakeDetermineVSServicePack.cmake not included")
endif()

View File

@@ -38,3 +38,8 @@ run_cmake(CMP0191-OLD)
run_cmake(CMP0191-WARN)
run_cmake(CMP0191-NEW-name)
run_cmake(CMP0191-NEW-path)
run_cmake(CMP0196-OLD)
run_cmake(CMP0196-WARN)
run_cmake(CMP0196-NEW-name)
run_cmake(CMP0196-NEW-path)