summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-25 13:38:59 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-04-25 13:39:06 (GMT)
commit7dca104e14519be4ff28978a1553a3395ecaf6d2 (patch)
tree766cff43b4ed7c4144435c6a2675b584d2c8a457 /Source
parent959ad1d5e8bbd07b4111630c347ca3d69353f48b (diff)
parent4f5bbbeab9bbe7dd3aa3bd9be5d201ed2447bad1 (diff)
downloadCMake-7dca104e14519be4ff28978a1553a3395ecaf6d2.zip
CMake-7dca104e14519be4ff28978a1553a3395ecaf6d2.tar.gz
CMake-7dca104e14519be4ff28978a1553a3395ecaf6d2.tar.bz2
Merge topic 'deprecate-policy-old'
4f5bbbea Add deprecation warnings for policies CMP0036 and below Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !743
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx7
-rw-r--r--Source/cmPolicies.cxx16
-rw-r--r--Source/cmPolicies.h1
3 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4ed76c7..b8a5293 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4002,6 +4002,13 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
return false;
}
+ // Deprecate old policies, especially those that require a lot
+ // of code to maintain the old behavior.
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0036) {
+ this->IssueMessage(cmake::DEPRECATION_WARNING,
+ cmPolicies::GetPolicyDeprecatedWarning(id));
+ }
+
this->StateSnapshot.SetPolicy(id, status);
return true;
}
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 837557b..da3edd4 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)
{
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 120beb6..69cbc18 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -279,6 +279,7 @@ public:
///! return a warning string for a given policy
static std::string GetPolicyWarning(cmPolicies::PolicyID id);
+ static std::string GetPolicyDeprecatedWarning(cmPolicies::PolicyID id);
///! return an error string for when a required policy is unspecified
static std::string GetRequiredPolicyError(cmPolicies::PolicyID id);