summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-06-05 17:19:07 (GMT)
committerBrad King <brad.king@kitware.com>2024-06-05 17:19:07 (GMT)
commit43944645019a8241485950384e3e9dba48a27347 (patch)
treec45d0e9b61db68d25e05c96a68551f504253c716
parent2eb4382d6bccebc1df895954b19b66b18f3c2f61 (diff)
downloadCMake-43944645019a8241485950384e3e9dba48a27347.zip
CMake-43944645019a8241485950384e3e9dba48a27347.tar.gz
CMake-43944645019a8241485950384e3e9dba48a27347.tar.bz2
Add deprecation warnings for policies CMP0129 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.23 and below to encourage projects to port away from setting policies to OLD.
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Tests/RunCMake/CMP0129/C-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0129/CXX-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0129/Fortran-OLD-stderr.txt10
4 files changed, 31 insertions, 1 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ba9fab5..b8a59a3 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4657,7 +4657,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
}
// Deprecate old policies.
- if (status == cmPolicies::OLD && id <= cmPolicies::CMP0128 &&
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0129 &&
!(this->GetCMakeInstance()->GetIsInTryCompile() &&
(
// Policies set by cmCoreTryCompile::TryCompileCode.
diff --git a/Tests/RunCMake/CMP0129/C-OLD-stderr.txt b/Tests/RunCMake/CMP0129/C-OLD-stderr.txt
new file mode 100644
index 0000000..5c622d2
--- /dev/null
+++ b/Tests/RunCMake/CMP0129/C-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at C-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0129 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\)$
diff --git a/Tests/RunCMake/CMP0129/CXX-OLD-stderr.txt b/Tests/RunCMake/CMP0129/CXX-OLD-stderr.txt
new file mode 100644
index 0000000..71a1ecf
--- /dev/null
+++ b/Tests/RunCMake/CMP0129/CXX-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CXX-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0129 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\)$
diff --git a/Tests/RunCMake/CMP0129/Fortran-OLD-stderr.txt b/Tests/RunCMake/CMP0129/Fortran-OLD-stderr.txt
new file mode 100644
index 0000000..01260c0
--- /dev/null
+++ b/Tests/RunCMake/CMP0129/Fortran-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Fortran-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0129 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\)$