summaryrefslogtreecommitdiff
path: root/Source/cmake.h
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-11-30 12:48:26 +0100
committerDaniel Mensinger <daniel@mensinger-ka.de>2019-12-23 14:05:36 +0100
commit482497e0debc3de9f125c8c849a40872971a4a7e (patch)
tree2ae4aefba1e626668e411c53399cc241662e18d7 /Source/cmake.h
parent10fea25139cc302ef0f0a41aa68b44cda72a4fd2 (diff)
downloadcmake-482497e0debc3de9f125c8c849a40872971a4a7e.tar.gz
trace: Add JSON output format
Add a new `--trace-format=` flag, to enable the new JSON trace output format. This new format is easier to parse by machines than the existing format. This new format also removes the ambiguity of the whitespace in the "old" format (e.g. is that whitespace part of a file path, or does it seperate arguments)
Diffstat (limited to 'Source/cmake.h')
-rw-r--r--Source/cmake.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/Source/cmake.h b/Source/cmake.h
index 02de4c1af9..54fdc03732 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -113,6 +113,14 @@ public:
LOG_TRACE
};
+ /** \brief Define supported trace formats **/
+ enum TraceFormat
+ {
+ TRACE_UNDEFINED,
+ TRACE_HUMAN,
+ TRACE_JSON_V1,
+ };
+
struct GeneratorInfo
{
std::string name;
@@ -389,6 +397,7 @@ public:
LogLevel GetLogLevel() const { return this->MessageLogLevel; }
void SetLogLevel(LogLevel level) { this->MessageLogLevel = level; }
static LogLevel StringToLogLevel(const std::string& levelStr);
+ static TraceFormat StringToTraceFormat(const std::string& levelStr);
bool HasCheckInProgress() const
{
@@ -418,10 +427,12 @@ public:
void SetShowLogContext(bool b) { this->LogContext = b; }
//! Do we want trace output during the cmake run.
- bool GetTrace() { return this->Trace; }
+ bool GetTrace() const { return this->Trace; }
void SetTrace(bool b) { this->Trace = b; }
- bool GetTraceExpand() { return this->TraceExpand; }
+ bool GetTraceExpand() const { return this->TraceExpand; }
void SetTraceExpand(bool b) { this->TraceExpand = b; }
+ TraceFormat GetTraceFormat() const { return this->TraceFormatVar; }
+ void SetTraceFormat(TraceFormat f) { this->TraceFormatVar = f; }
void AddTraceSource(std::string const& file)
{
this->TraceOnlyThisSources.push_back(file);
@@ -432,6 +443,7 @@ public:
}
cmGeneratedFileStream& GetTraceFile() { return this->TraceFile; }
void SetTraceFile(std::string const& file);
+ void PrintTraceFormatVersion();
bool GetWarnUninitialized() { return this->WarnUninitialized; }
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; }
@@ -579,6 +591,7 @@ private:
bool DebugOutput = false;
bool Trace = false;
bool TraceExpand = false;
+ TraceFormat TraceFormatVar = TRACE_HUMAN;
cmGeneratedFileStream TraceFile;
bool WarnUninitialized = false;
bool WarnUnused = false;