summaryrefslogtreecommitdiff
path: root/Source/cmMessageCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-06-12 18:38:33 +0200
committerStephen Kelly <steveire@gmail.com>2016-06-12 18:38:33 +0200
commit0a4af0735f2aeec74a723dd6af31db585f1b664e (patch)
treebf4ab5b590350d3f2203de3b797897ffb37b6596 /Source/cmMessageCommand.cxx
parentd6e99fa8345f07a72308b8b33f4a31aa7fe9a0fd (diff)
downloadcmake-0a4af0735f2aeec74a723dd6af31db585f1b664e.tar.gz
cmake: Issue message independent of cmMakefile definition
The makefile is only used when called by the cmMessageCommand, so inline the use of it there. It otherwise creates an undesirable dependency on cmMakefile for issuing messages in the cmake instance, a violation of the Interface Segregation Principle. https://en.wikipedia.org/wiki/Interface_segregation_principle This also makes it more explicit that the variable definitions only affect the message() command. If an AUTHOR_WARNING is issued for any other reason, it is not affected. To affect that, it is necessary to set the cache variable instead of the regular variable. This is an unfortunate interface quirk, but one which can't be fixed easily now.
Diffstat (limited to 'Source/cmMessageCommand.cxx')
-rw-r--r--Source/cmMessageCommand.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index f4458a7dac..dab90c9144 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -24,7 +24,6 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
cmake::MessageType type = cmake::MESSAGE;
bool status = false;
bool fatal = false;
- cmake* cm = this->Makefile->GetCMakeInstance();
if (*i == "SEND_ERROR") {
type = cmake::FATAL_ERROR;
++i;
@@ -36,10 +35,11 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
type = cmake::WARNING;
++i;
} else if (*i == "AUTHOR_WARNING") {
- if (cm->GetDevWarningsAsErrors(this->Makefile)) {
+ if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
+ !this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) {
fatal = true;
type = cmake::AUTHOR_ERROR;
- } else if (!cm->GetSuppressDevWarnings(this->Makefile)) {
+ } else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
type = cmake::AUTHOR_WARNING;
} else {
return true;
@@ -49,10 +49,11 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
status = true;
++i;
} else if (*i == "DEPRECATION") {
- if (cm->GetDeprecatedWarningsAsErrors(this->Makefile)) {
+ if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) {
fatal = true;
type = cmake::DEPRECATION_ERROR;
- } else if (!cm->GetSuppressDeprecatedWarnings(this->Makefile)) {
+ } else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") ||
+ this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) {
type = cmake::DEPRECATION_WARNING;
} else {
return true;