summaryrefslogtreecommitdiff
path: root/Source/cmPolicies.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-21 14:29:27 -0400
committerBrad King <brad.king@kitware.com>2017-04-21 15:04:33 -0400
commit4f5bbbeab9bbe7dd3aa3bd9be5d201ed2447bad1 (patch)
tree5b9afb2c7559f9a69137cbdcace548e9540c16bb /Source/cmPolicies.cxx
parent294cf948dc37799e1980685afbf1fa585ad5b0fb (diff)
downloadcmake-4f5bbbeab9bbe7dd3aa3bd9be5d201ed2447bad1.tar.gz
Add deprecation warnings for policies CMP0036 and below
The OLD behaviors of all policies are deprecated, but only by documentation. Add an explicit deprecation diagnostic for some policies to encourage projects to port away from setting policies to OLD.
Diffstat (limited to 'Source/cmPolicies.cxx')
-rw-r--r--Source/cmPolicies.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 837557b7f8..da3edd427e 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -275,6 +275,22 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
return msg.str();
}
+std::string cmPolicies::GetPolicyDeprecatedWarning(cmPolicies::PolicyID id)
+{
+ std::ostringstream msg;
+ /* clang-format off */
+ msg <<
+ "The OLD behavior for policy " << idToString(id) << " "
+ "will be removed from a future version of CMake.\n"
+ "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."
+ ;
+ /* clang-format on */
+ return msg.str();
+}
+
///! return an error string for when a required policy is unspecified
std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
{