CMake Nightly Date Stamp
[kiteware-cmake.git] / Source / cmMessenger.h
blobd9462d444970820fa36641ef94386d056fddea30
1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #pragma once
5 #include "cmConfigure.h" // IWYU pragma: keep
7 #include <iosfwd>
8 #include <memory>
9 #include <string>
11 #include <cm/optional>
13 #include "cmListFileCache.h"
14 #include "cmMessageType.h" // IWYU pragma: keep
16 #ifdef CMake_ENABLE_DEBUGGER
17 namespace cmDebugger {
18 class cmDebuggerAdapter;
20 #endif
22 class cmMessenger
24 public:
25 void IssueMessage(
26 MessageType t, std::string const& text,
27 cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const;
29 void DisplayMessage(MessageType t, std::string const& text,
30 cmListFileBacktrace const& backtrace) const;
32 void SetTopSource(cm::optional<std::string> topSource);
34 void SetSuppressDevWarnings(bool suppress)
36 this->SuppressDevWarnings = suppress;
38 void SetSuppressDeprecatedWarnings(bool suppress)
40 this->SuppressDeprecatedWarnings = suppress;
42 void SetDevWarningsAsErrors(bool error)
44 this->DevWarningsAsErrors = error;
46 void SetDeprecatedWarningsAsErrors(bool error)
48 this->DeprecatedWarningsAsErrors = error;
51 bool GetSuppressDevWarnings() const { return this->SuppressDevWarnings; }
52 bool GetSuppressDeprecatedWarnings() const
54 return this->SuppressDeprecatedWarnings;
56 bool GetDevWarningsAsErrors() const { return this->DevWarningsAsErrors; }
57 bool GetDeprecatedWarningsAsErrors() const
59 return this->DeprecatedWarningsAsErrors;
62 // Print the top of a backtrace.
63 void PrintBacktraceTitle(std::ostream& out,
64 cmListFileBacktrace const& bt) const;
65 #ifdef CMake_ENABLE_DEBUGGER
66 void SetDebuggerAdapter(
67 std::shared_ptr<cmDebugger::cmDebuggerAdapter> const& debuggerAdapter)
69 DebuggerAdapter = debuggerAdapter;
71 #endif
73 private:
74 bool IsMessageTypeVisible(MessageType t) const;
75 MessageType ConvertMessageType(MessageType t) const;
77 cm::optional<std::string> TopSource;
79 bool SuppressDevWarnings = false;
80 bool SuppressDeprecatedWarnings = false;
81 bool DevWarningsAsErrors = false;
82 bool DeprecatedWarningsAsErrors = false;
83 #ifdef CMake_ENABLE_DEBUGGER
84 std::shared_ptr<cmDebugger::cmDebuggerAdapter> DebuggerAdapter;
85 #endif