diff options
author | Brad King <brad.king@kitware.com> | 2022-02-03 15:36:37 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-02-03 19:13:12 (GMT) |
commit | a9ffded98cb0a8cdfe95bd21069de215810c0b6f (patch) | |
tree | 2486966da86e1740b639d9ab5c8700c68e1146df /Source | |
parent | 40107d308f6d7687edbe5e75a77a67b9cb9112aa (diff) | |
download | CMake-a9ffded98cb0a8cdfe95bd21069de215810c0b6f.zip CMake-a9ffded98cb0a8cdfe95bd21069de215810c0b6f.tar.gz CMake-a9ffded98cb0a8cdfe95bd21069de215810c0b6f.tar.bz2 |
Add deprecation warnings for policies CMP0097 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.16 and below to encourage projects to port
away from setting policies to OLD.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefile.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 68e61bb..4b1635b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4395,12 +4395,14 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, } // Deprecate old policies. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0094 && + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0097 && !(this->GetCMakeInstance()->GetIsInTryCompile() && ( // Policies set by cmCoreTryCompile::TryCompileCode. id == cmPolicies::CMP0065 || id == cmPolicies::CMP0083 || - id == cmPolicies::CMP0091))) { + id == cmPolicies::CMP0091)) && + (!this->IsSet("CMAKE_WARN_DEPRECATED") || + this->IsOn("CMAKE_WARN_DEPRECATED"))) { this->IssueMessage(MessageType::DEPRECATION_WARNING, cmPolicies::GetPolicyDeprecatedWarning(id)); } |