mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-12 01:59:43 -06:00
Add deprecation warnings for policies CMP0151 and below
The OLD behaviors of all policies are deprecated, but only by documentation. Add an explicit deprecation diagnostic for policies introduced in CMake 3.27 and below to encourage projects to port away from setting policies to OLD.
This commit is contained in:
@@ -4085,7 +4085,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
|
||||
}
|
||||
|
||||
// Deprecate old policies.
|
||||
if (status == cmPolicies::OLD && id <= cmPolicies::CMP0143 &&
|
||||
if (status == cmPolicies::OLD && id <= cmPolicies::CMP0151 &&
|
||||
!(this->GetCMakeInstance()->GetIsInTryCompile() &&
|
||||
(
|
||||
// Policies set by cmCoreTryCompile::TryCompileCode.
|
||||
|
||||
@@ -102,7 +102,9 @@ if (DEFINED with_qt_version)
|
||||
|
||||
block()
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0151-old-build)
|
||||
set(RunCMake_TEST_EXPECT_stderr ".") # ignore CMP0151 deprecation warnings
|
||||
run_cmake_with_options(CMP0151-old ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTO${autogen_type}=ON -DCMAKE_POLICY_DEFAULT_CMP0151=OLD)
|
||||
unset(RunCMake_TEST_EXPECT_stderr)
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}")
|
||||
run_cmake_command(CMP0151-old-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
|
||||
@@ -119,7 +121,9 @@ if (DEFINED with_qt_version)
|
||||
if (RunCMake_GENERATOR MATCHES "(Ninja|Makefiles|Visual Studio)")
|
||||
block()
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0151Short-old-build)
|
||||
set(RunCMake_TEST_EXPECT_stderr ".") # ignore CMP0151 deprecation warnings
|
||||
run_cmake_with_options(CMP0151Short-old ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTO${autogen_type}=ON -DCMAKE_POLICY_DEFAULT_CMP0151=OLD)
|
||||
unset(RunCMake_TEST_EXPECT_stderr)
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout_short}")
|
||||
run_cmake_command(CMP0151Short-old-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
|
||||
|
||||
9
Tests/RunCMake/CMP0150/CMP0150-OLD-stderr.txt
Normal file
9
Tests/RunCMake/CMP0150/CMP0150-OLD-stderr.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
^CMake Deprecation Warning at ([^
|
||||
]*/Tests/RunCMake/CMP0150/)?OLD-build/Top/CMakeLists\.txt:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0150 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.$
|
||||
23
Tests/RunCMake/CTest/CMP0145-Dart-OLD-stderr.txt
Normal file
23
Tests/RunCMake/CTest/CMP0145-Dart-OLD-stderr.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
^CMake Deprecation Warning at CMP0145-Dart-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0145 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:5 \(include\)
|
||||
+
|
||||
CMake Deprecation Warning at [^
|
||||
]*/Modules/Dart\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0145 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMP0145-Dart-OLD\.cmake:3 \(include\)
|
||||
CMakeLists\.txt:5 \(include\)$
|
||||
@@ -15,4 +15,17 @@ CMake Warning \(dev\) at [^
|
||||
Call Stack \(most recent call first\):
|
||||
CMP0145-Dart-WARN\.cmake:[0-9]+ \(include\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.$
|
||||
This warning is for project developers\. Use -Wno-dev to suppress it\.
|
||||
+
|
||||
CMake Deprecation Warning at [^
|
||||
]*/Modules/Dart\.cmake:[0-9]+6 \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0145 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMP0145-Dart-WARN\.cmake:[0-9]+ \(include\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
|
||||
10
Tests/RunCMake/CTest/CMP0145-FindDart-OLD-stderr.txt
Normal file
10
Tests/RunCMake/CTest/CMP0145-FindDart-OLD-stderr.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
^CMake Deprecation Warning at CMP0145-FindDart-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0145 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
@@ -105,7 +105,9 @@ if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio (1[45678])( 20[0-9][0-9])?$")
|
||||
endforeach()
|
||||
foreach(expect_version IN LISTS kits)
|
||||
set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMP0149-OLD-${expect_version}")
|
||||
set(RunCMake_TEST_EXPECT_stderr ".") # ignore CMP0149 deprecation warnings
|
||||
run_cmake_with_options(VersionExists -DCMAKE_SYSTEM_VERSION=${expect_version} -DCMAKE_POLICY_DEFAULT_CMP0149=OLD)
|
||||
unset(RunCMake_TEST_EXPECT_stderr)
|
||||
endforeach()
|
||||
if(kits MATCHES "(^|;)([0-9.]+)$")
|
||||
set(expect_version "${CMAKE_MATCH_2}")
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
^CMake Deprecation Warning at CustomCommandParallelDisable\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0147 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
@@ -1,4 +1,15 @@
|
||||
^----------
|
||||
^CMake Deprecation Warning at CMP0144-OLD-CaseInsensitive\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0144 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
+
|
||||
----------
|
||||
FOO_ROOT : ''
|
||||
ENV{FOO_ROOT}: ''
|
||||
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
^----------
|
||||
^CMake Deprecation Warning at CMP0144-OLD-CaseSensitive\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0144 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
+
|
||||
----------
|
||||
FOO_ROOT : ''
|
||||
ENV{FOO_ROOT}: ''
|
||||
|
||||
|
||||
10
Tests/RunCMake/find_package/CMP0145-OLD-stderr.txt
Normal file
10
Tests/RunCMake/find_package/CMP0145-OLD-stderr.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
^CMake Deprecation Warning at CMP0145-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0145 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
10
Tests/RunCMake/find_package/CMP0146-OLD-stderr.txt
Normal file
10
Tests/RunCMake/find_package/CMP0146-OLD-stderr.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
^CMake Deprecation Warning at CMP0146-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0146 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
@@ -1,4 +1,16 @@
|
||||
^CMake Error at [^
|
||||
^CMake Deprecation Warning at CMP0147-common\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0146 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMP0147-NEW\.cmake:[0-9]+ \(include\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
+
|
||||
CMake Error at [^
|
||||
]*/Modules/FindCUDA\.cmake:[0-9]+ \(message\):
|
||||
The FindCUDA module does not work in Visual Studio with policy CMP0147\.
|
||||
Call Stack \(most recent call first\):
|
||||
|
||||
22
Tests/RunCMake/find_package/CMP0147-OLD-stderr.txt
Normal file
22
Tests/RunCMake/find_package/CMP0147-OLD-stderr.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
^CMake Deprecation Warning at CMP0147-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0147 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
+
|
||||
CMake Deprecation Warning at CMP0147-common\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0146 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMP0147-OLD\.cmake:2 \(include\)
|
||||
CMakeLists\.txt:3 \(include\)$
|
||||
11
Tests/RunCMake/find_package/CMP0147-WARN-stderr.txt
Normal file
11
Tests/RunCMake/find_package/CMP0147-WARN-stderr.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
^CMake Deprecation Warning at CMP0147-common\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0146 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMP0147-WARN\.cmake:[0-9]+ \(include\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
10
Tests/RunCMake/find_package/CMP0148-Interp-OLD-stderr.txt
Normal file
10
Tests/RunCMake/find_package/CMP0148-Interp-OLD-stderr.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
^CMake Deprecation Warning at CMP0148-Interp-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0148 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
10
Tests/RunCMake/find_package/CMP0148-Libs-OLD-stderr.txt
Normal file
10
Tests/RunCMake/find_package/CMP0148-Libs-OLD-stderr.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
^CMake Deprecation Warning at CMP0148-Libs-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0148 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
10
Tests/RunCMake/include/CMP0146-OLD-stderr.txt
Normal file
10
Tests/RunCMake/include/CMP0146-OLD-stderr.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
^CMake Deprecation Warning at CMP0146-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0146 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
10
Tests/RunCMake/include/CMP0148-Interp-OLD-stderr.txt
Normal file
10
Tests/RunCMake/include/CMP0148-Interp-OLD-stderr.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
^CMake Deprecation Warning at CMP0148-Interp-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0148 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
10
Tests/RunCMake/include/CMP0148-Libs-OLD-stderr.txt
Normal file
10
Tests/RunCMake/include/CMP0148-Libs-OLD-stderr.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
^CMake Deprecation Warning at CMP0148-Libs-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
||||
The OLD behavior for policy CMP0148 will be removed from a future version
|
||||
of CMake\.
|
||||
|
||||
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||
policies are deprecated and that a policy should be set to OLD only under
|
||||
specific short-term circumstances\. Projects should be ported to the NEW
|
||||
behavior and not rely on setting a policy to OLD\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||
Reference in New Issue
Block a user