summaryrefslogtreecommitdiff
path: root/Source/cmCommand.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-18 11:54:09 -0400
committerBrad King <brad.king@kitware.com>2013-10-22 09:09:51 -0400
commit882c0f0b698e70be8b74aa498b62cb1fb22f3c24 (patch)
tree9154c655d59026c3ccf89b72f8e34da36694939d /Source/cmCommand.h
parentddef8a7cfffbbae12f2d2c556651f06346237569 (diff)
downloadcmake-882c0f0b698e70be8b74aa498b62cb1fb22f3c24.tar.gz
Add infrastructure for policies that disallow commands
Add cmCommand::Disallowed helper to check the setting of a policy that disallows the command. Add a RunCMake.DisallowedCommands test placeholder. Add a Help/policy/DISALLOWED_COMMAND.txt file for inclusion by each policy document to avoid duplication of the common text.
Diffstat (limited to 'Source/cmCommand.h')
-rw-r--r--Source/cmCommand.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 83184a0e4a..e1488571f6 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -173,6 +173,25 @@ public:
this->Error += e;
}
+ /** Check if the command is disallowed by a policy. */
+ bool Disallowed(cmPolicies::PolicyID pol, const char* e)
+ {
+ switch(this->Makefile->GetPolicyStatus(pol))
+ {
+ case cmPolicies::WARN:
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
+ this->Makefile->GetPolicies()->GetPolicyWarning(pol));
+ case cmPolicies::OLD:
+ return false;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e);
+ break;
+ }
+ return true;
+ }
+
protected:
cmMakefile* Makefile;
cmCommandArgumentsHelper Helper;