MCPcopy Create free account
hub / github.com/Kitware/CMake / displayMessage

Function displayMessage

Source/cmMessenger.cxx:72–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void displayMessage(MessageType t, std::ostringstream& msg)
73{
74 // Add a note about warning suppression.
75 if (t == MessageType::AUTHOR_WARNING) {
76 msg << "This warning is for project developers. Use -Wno-dev to suppress "
77 "it.";
78 } else if (t == MessageType::AUTHOR_ERROR) {
79 msg << "This error is for project developers. Use -Wno-error=dev to "
80 "suppress it.";
81 }
82
83 // Add a terminating blank line.
84 msg << '\n';
85
86#if !defined(CMAKE_BOOTSTRAP)
87 // Add a C++ stack trace to internal errors.
88 if (t == MessageType::INTERNAL_ERROR) {
89 std::string stack = cmsys::SystemInformation::GetProgramStack(0, 0);
90 if (!stack.empty()) {
91 if (cmHasLiteralPrefix(stack, "WARNING:")) {
92 stack = "Note:" + stack.substr(8);
93 }
94 msg << stack << '\n';
95 }
96 }
97#endif
98
99 // Output the message.
100 cmMessageMetadata md;
101 md.attrs = getMessageColor(t);
102 if (t == MessageType::FATAL_ERROR || t == MessageType::INTERNAL_ERROR ||
103 t == MessageType::DEPRECATION_ERROR || t == MessageType::AUTHOR_ERROR) {
104 cmSystemTools::SetErrorOccurred();
105 md.title = "Error";
106 } else {
107 md.title = "Warning";
108 }
109 cmSystemTools::Message(msg.str(), md);
110}
111
112void PrintCallStack(std::ostream& out, cmListFileBacktrace bt,
113 cm::optional<std::string> const& topSource)

Callers 1

DisplayMessageMethod · 0.85

Calls 6

cmHasLiteralPrefixFunction · 0.85
getMessageColorFunction · 0.85
MessageClass · 0.85
strMethod · 0.80
emptyMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…