cmake/Source/cmMessenger.h

87 lines
2.2 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2016-10-30 18:24:19 +01:00
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
2022-03-29 21:10:50 +02:00
#include <iosfwd>
2023-07-02 19:51:09 +02:00
#include <memory>
2020-02-01 23:06:01 +01:00
#include <string>
2022-03-29 21:10:50 +02:00
#include <cm/optional>
2016-10-30 18:24:19 +01:00
#include "cmListFileCache.h"
2019-11-11 23:01:05 +01:00
#include "cmMessageType.h"
2016-10-30 18:24:19 +01:00
2023-07-02 19:51:09 +02:00
#ifdef CMake_ENABLE_DEBUGGER
namespace cmDebugger {
class cmDebuggerAdapter;
}
#endif
2016-10-30 18:24:19 +01:00
class cmMessenger
{
public:
void IssueMessage(
2019-11-11 23:01:05 +01:00
MessageType t, std::string const& text,
2016-10-30 18:24:19 +01:00
cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const;
2019-11-11 23:01:05 +01:00
void DisplayMessage(MessageType t, std::string const& text,
2016-10-30 18:24:19 +01:00
cmListFileBacktrace const& backtrace) const;
2022-03-29 21:10:50 +02:00
void SetTopSource(cm::optional<std::string> topSource);
2019-11-11 23:01:05 +01:00
void SetSuppressDevWarnings(bool suppress)
{
this->SuppressDevWarnings = suppress;
}
void SetSuppressDeprecatedWarnings(bool suppress)
{
this->SuppressDeprecatedWarnings = suppress;
}
void SetDevWarningsAsErrors(bool error)
{
this->DevWarningsAsErrors = error;
}
void SetDeprecatedWarningsAsErrors(bool error)
{
this->DeprecatedWarningsAsErrors = error;
}
bool GetSuppressDevWarnings() const { return this->SuppressDevWarnings; }
bool GetSuppressDeprecatedWarnings() const
{
return this->SuppressDeprecatedWarnings;
}
bool GetDevWarningsAsErrors() const { return this->DevWarningsAsErrors; }
bool GetDeprecatedWarningsAsErrors() const
{
return this->DeprecatedWarningsAsErrors;
}
2016-10-30 18:24:19 +01:00
2022-03-29 21:10:50 +02:00
// Print the top of a backtrace.
void PrintBacktraceTitle(std::ostream& out,
cmListFileBacktrace const& bt) const;
2023-07-02 19:51:09 +02:00
#ifdef CMake_ENABLE_DEBUGGER
void SetDebuggerAdapter(
std::shared_ptr<cmDebugger::cmDebuggerAdapter> const& debuggerAdapter)
{
DebuggerAdapter = debuggerAdapter;
}
#endif
2022-03-29 21:10:50 +02:00
2016-10-30 18:24:19 +01:00
private:
2019-11-11 23:01:05 +01:00
bool IsMessageTypeVisible(MessageType t) const;
MessageType ConvertMessageType(MessageType t) const;
2016-10-30 18:24:19 +01:00
2022-03-29 21:10:50 +02:00
cm::optional<std::string> TopSource;
2019-11-11 23:01:05 +01:00
bool SuppressDevWarnings = false;
bool SuppressDeprecatedWarnings = false;
bool DevWarningsAsErrors = false;
bool DeprecatedWarningsAsErrors = false;
2023-07-02 19:51:09 +02:00
#ifdef CMake_ENABLE_DEBUGGER
std::shared_ptr<cmDebugger::cmDebuggerAdapter> DebuggerAdapter;
#endif
2016-10-30 18:24:19 +01:00
};