cmake: Extract PrintMessagePreamble method.

This commit is contained in:
Stephen Kelly 2015-05-22 00:31:52 +02:00
parent fa752bf339
commit ca7cc2ebd0
2 changed files with 19 additions and 8 deletions

View File

@ -2436,14 +2436,8 @@ static bool cmakeCheckStampList(const char* stampList)
return true; return true;
} }
//---------------------------------------------------------------------------- bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg)
void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& bt)
{ {
cmListFileBacktrace backtrace = bt;
backtrace.MakeRelative();
std::ostringstream msg;
// Construct the message header. // Construct the message header.
if(t == cmake::FATAL_ERROR) if(t == cmake::FATAL_ERROR)
{ {
@ -2475,11 +2469,26 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
"CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); "CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
if(suppress && cmSystemTools::IsOn(suppress)) if(suppress && cmSystemTools::IsOn(suppress))
{ {
return; return false;
} }
msg << " (dev)"; msg << " (dev)";
} }
} }
return true;
}
//----------------------------------------------------------------------------
void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& bt)
{
cmListFileBacktrace backtrace = bt;
backtrace.MakeRelative();
std::ostringstream msg;
if (!this->PrintMessagePreamble(t, msg))
{
return;
}
// Add the immediate context. // Add the immediate context.
backtrace.PrintTitle(msg); backtrace.PrintTitle(msg);

View File

@ -399,6 +399,8 @@ private:
// Print a list of valid generators to stderr. // Print a list of valid generators to stderr.
void PrintGeneratorList(); void PrintGeneratorList();
bool PrintMessagePreamble(cmake::MessageType t, std::ostream& msg);
}; };
#define CMAKE_STANDARD_OPTIONS_TABLE \ #define CMAKE_STANDARD_OPTIONS_TABLE \