Kaynağa Gözat

Add deprecation warnings for policies CMP0139 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.24 and below to encourage projects to port
away from setting policies to OLD.
Brad King 1 yıl önce
ebeveyn
işleme
fe6cf6d28c

+ 2 - 2
Source/cmMakefile.cxx

@@ -4645,14 +4645,14 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
   }
 
   // Deprecate old policies.
-  if (status == cmPolicies::OLD && id <= cmPolicies::CMP0129 &&
+  if (status == cmPolicies::OLD && id <= cmPolicies::CMP0139 &&
       !(this->GetCMakeInstance()->GetIsInTryCompile() &&
         (
           // Policies set by cmCoreTryCompile::TryCompileCode.
           id == cmPolicies::CMP0065 || id == cmPolicies::CMP0083 ||
           id == cmPolicies::CMP0091 || id == cmPolicies::CMP0104 ||
           id == cmPolicies::CMP0123 || id == cmPolicies::CMP0126 ||
-          id == cmPolicies::CMP0128)) &&
+          id == cmPolicies::CMP0128 || id == cmPolicies::CMP0136)) &&
       (!this->IsSet("CMAKE_WARN_DEPRECATED") ||
        this->IsOn("CMAKE_WARN_DEPRECATED"))) {
     this->IssueMessage(MessageType::DEPRECATION_WARNING,

+ 10 - 0
Tests/RunCMake/CMP0132/CMP0132-OLD-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0132-OLD\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0132 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 - 0
Tests/RunCMake/CMP0135/CMP0135-OLD-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0135-OLD\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0135 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\)$

+ 12 - 1
Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt

@@ -1,3 +1,14 @@
+^CMake Deprecation Warning at CMP0139-OLD\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0139 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\)
++
 CMake Error at CMP0139-OLD.cmake:[0-9]+ \(if\):
   if given arguments:
 
@@ -5,4 +16,4 @@ CMake Error at CMP0139-OLD.cmake:[0-9]+ \(if\):
 
   Unknown arguments specified
 Call Stack \(most recent call first\):
-  CMakeLists.txt:[0-9]+ \(include\)
+  CMakeLists.txt:[0-9]+ \(include\)$

+ 10 - 0
Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0138-OLD\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0138 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 - 0
Tests/RunCMake/block/Scope-POLICIES-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Scope-POLICIES\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0139 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 - 0
Tests/RunCMake/block/Scope-VARIABLES-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Scope-VARIABLES\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0139 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 - 0
Tests/RunCMake/block/Scope-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Scope\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0139 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 - 0
Tests/RunCMake/find_file/Registry-query-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Registry-query\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0134 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 - 0
Tests/RunCMake/find_library/Registry-query-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Registry-query\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0134 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 - 0
Tests/RunCMake/find_package/Registry-query-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Registry-query\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0134 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 - 0
Tests/RunCMake/find_path/Registry-query-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Registry-query\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0134 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 - 0
Tests/RunCMake/find_program/Registry-query-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at Registry-query\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0134 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 - 0
Tests/RunCMake/while/CMP0130-OLD-stderr.txt

@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0130-OLD\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0130 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\)$