diff options
author | Brad King <brad.king@kitware.com> | 2021-10-08 14:17:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-10-08 16:17:04 (GMT) |
commit | 0f31463c37dd5cafa27df8fd4a0cb161d18f2f0b (patch) | |
tree | 7c395c0f7525f93c003b8559f28d5adeab9f85d2 | |
parent | 3068ea834ff17bd5d2e8438c1a8d3a6331d10f62 (diff) | |
download | CMake-0f31463c37dd5cafa27df8fd4a0cb161d18f2f0b.zip CMake-0f31463c37dd5cafa27df8fd4a0cb161d18f2f0b.tar.gz CMake-0f31463c37dd5cafa27df8fd4a0cb161d18f2f0b.tar.bz2 |
Add deprecation warnings for policies CMP0094 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.15 and below to encourage projects to port
away from setting policies to OLD.
-rw-r--r-- | Source/cmMakefile.cxx | 5 | ||||
-rw-r--r-- | Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt | 10 | ||||
-rw-r--r-- | Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt | 10 | ||||
-rw-r--r-- | Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD-stderr.txt | 10 |
4 files changed, 33 insertions, 2 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 83984f7..23b97ed 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4427,11 +4427,12 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, } // Deprecate old policies. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0088 && + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0094 && !(this->GetCMakeInstance()->GetIsInTryCompile() && ( // Policies set by cmCoreTryCompile::TryCompileCode. - id == cmPolicies::CMP0065 || id == cmPolicies::CMP0083))) { + id == cmPolicies::CMP0065 || id == cmPolicies::CMP0083 || + id == cmPolicies::CMP0091))) { this->IssueMessage(MessageType::DEPRECATION_WARNING, cmPolicies::GetPolicyDeprecatedWarning(id)); } diff --git a/Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt b/Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt new file mode 100644 index 0000000..899122e --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0093-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0093 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/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt new file mode 100644 index 0000000..3984a78 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0091-OLD.cmake:[0-9] \(cmake_policy\): + The OLD behavior for policy CMP0091 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/MSVCWarningFlags/CMP0092-OLD-stderr.txt b/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD-stderr.txt new file mode 100644 index 0000000..535b997 --- /dev/null +++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0092-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0092 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\)$ |