summaryrefslogtreecommitdiffstats
path: root/Source/cmMessageCommand.cxx
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2019-10-10 11:42:23 (GMT)
committerCraig Scott <craig.scott@crascit.com>2019-10-12 02:39:55 (GMT)
commit4b021bd3e9f0d8b5ab5f8a8dc961441a7a063e25 (patch)
tree3ab82c36b2275559ce58a53464cf2e764bff0d2c /Source/cmMessageCommand.cxx
parentfe9a903d8ee70b62a9d598dcfebeab0ded0b2e05 (diff)
downloadCMake-4b021bd3e9f0d8b5ab5f8a8dc961441a7a063e25.zip
CMake-4b021bd3e9f0d8b5ab5f8a8dc961441a7a063e25.tar.gz
CMake-4b021bd3e9f0d8b5ab5f8a8dc961441a7a063e25.tar.bz2
message: Minor refactor to make code less verbose
Diffstat (limited to 'Source/cmMessageCommand.cxx')
-rw-r--r--Source/cmMessageCommand.cxx28
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 96a6386..15c007c 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -21,6 +21,9 @@ bool cmMessageCommand(std::vector<std::string> const& args,
status.SetError("called with incorrect number of arguments");
return false;
}
+
+ auto& mf = status.GetMakefile();
+
auto i = args.cbegin();
auto type = MessageType::MESSAGE;
@@ -40,13 +43,12 @@ bool cmMessageCommand(std::vector<std::string> const& args,
level = cmake::LogLevel::LOG_WARNING;
++i;
} else if (*i == "AUTHOR_WARNING") {
- if (status.GetMakefile().IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
- !status.GetMakefile().IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) {
+ if (mf.IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
+ !mf.IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) {
fatal = true;
type = MessageType::AUTHOR_ERROR;
level = cmake::LogLevel::LOG_ERROR;
- } else if (!status.GetMakefile().IsOn(
- "CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
+ } else if (!mf.IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
type = MessageType::AUTHOR_WARNING;
level = cmake::LogLevel::LOG_WARNING;
} else {
@@ -66,12 +68,12 @@ bool cmMessageCommand(std::vector<std::string> const& args,
level = cmake::LogLevel::LOG_TRACE;
++i;
} else if (*i == "DEPRECATION") {
- if (status.GetMakefile().IsOn("CMAKE_ERROR_DEPRECATED")) {
+ if (mf.IsOn("CMAKE_ERROR_DEPRECATED")) {
fatal = true;
type = MessageType::DEPRECATION_ERROR;
level = cmake::LogLevel::LOG_ERROR;
- } else if (!status.GetMakefile().IsSet("CMAKE_WARN_DEPRECATED") ||
- status.GetMakefile().IsOn("CMAKE_WARN_DEPRECATED")) {
+ } else if (!mf.IsSet("CMAKE_WARN_DEPRECATED") ||
+ mf.IsOn("CMAKE_WARN_DEPRECATED")) {
type = MessageType::DEPRECATION_WARNING;
level = cmake::LogLevel::LOG_WARNING;
} else {
@@ -89,7 +91,7 @@ bool cmMessageCommand(std::vector<std::string> const& args,
assert("Message log level expected to be set" &&
level != cmake::LogLevel::LOG_UNDEFINED);
- auto desiredLevel = status.GetMakefile().GetCMakeInstance()->GetLogLevel();
+ auto desiredLevel = mf.GetCMakeInstance()->GetLogLevel();
assert("Expected a valid log level here" &&
desiredLevel != cmake::LogLevel::LOG_UNDEFINED);
@@ -104,9 +106,8 @@ bool cmMessageCommand(std::vector<std::string> const& args,
// Check if any indentation has requested:
// `CMAKE_MESSAGE_INDENT` is a list of "padding" pieces
// to be joined and prepended to the message lines.
- auto indent = cmJoin(cmExpandedList(status.GetMakefile().GetSafeDefinition(
- "CMAKE_MESSAGE_INDENT")),
- "");
+ auto indent =
+ cmJoin(cmExpandedList(mf.GetSafeDefinition("CMAKE_MESSAGE_INDENT")), "");
// Make every line of the `message` indented
// NOTE Can't reuse `cmDocumentationFormatter::PrintPreformatted`
// here cuz it appends `\n` to the EOM ;-(
@@ -118,8 +119,7 @@ bool cmMessageCommand(std::vector<std::string> const& args,
case cmake::LogLevel::LOG_ERROR:
case cmake::LogLevel::LOG_WARNING:
// we've overridden the message type, above, so display it directly
- status.GetMakefile().GetMessenger()->DisplayMessage(
- type, message, status.GetMakefile().GetBacktrace());
+ mf.GetMessenger()->DisplayMessage(type, message, mf.GetBacktrace());
break;
case cmake::LogLevel::LOG_NOTICE:
@@ -130,7 +130,7 @@ bool cmMessageCommand(std::vector<std::string> const& args,
case cmake::LogLevel::LOG_VERBOSE:
case cmake::LogLevel::LOG_DEBUG:
case cmake::LogLevel::LOG_TRACE:
- status.GetMakefile().DisplayStatus(message, -1);
+ mf.DisplayStatus(message, -1);
break;
default: