diff options
Diffstat (limited to 'Source/cmake.h')
-rw-r--r-- | Source/cmake.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/Source/cmake.h b/Source/cmake.h index 3183577..2f7f7bd 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -33,6 +33,7 @@ # include <cm3p/json/value.h> # include "cmCMakePresetsGraph.h" +# include "cmMakefileProfilingData.h" #endif class cmExternalMakefileProjectGeneratorFactory; @@ -41,9 +42,6 @@ class cmFileTimeCache; class cmGlobalGenerator; class cmGlobalGeneratorFactory; class cmMakefile; -#if !defined(CMAKE_BOOTSTRAP) -class cmMakefileProfilingData; -#endif class cmMessenger; class cmVariableWatch; struct cmBuildOptions; @@ -513,10 +511,19 @@ public: { return this->TraceOnlyThisSources; } - cmGeneratedFileStream& GetTraceFile() { return this->TraceFile; } + cmGeneratedFileStream& GetTraceFile() + { + if (this->TraceRedirect) { + return this->TraceRedirect->GetTraceFile(); + } + return this->TraceFile; + } void SetTraceFile(std::string const& file); void PrintTraceFormatVersion(); + //! Use trace from another ::cmake instance. + void SetTraceRedirect(cmake* other); + bool GetWarnUninitialized() const { return this->WarnUninitialized; } void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; } bool GetWarnUnusedCli() const { return this->WarnUnusedCli; } @@ -630,6 +637,17 @@ public: #if !defined(CMAKE_BOOTSTRAP) cmMakefileProfilingData& GetProfilingOutput(); bool IsProfilingEnabled() const; + + template <typename... Args> + cm::optional<cmMakefileProfilingData::RAII> CreateProfilingEntry( + Args&&... args) + { + if (this->IsProfilingEnabled()) { + return cm::make_optional<cmMakefileProfilingData::RAII>( + this->GetProfilingOutput(), std::forward<Args>(args)...); + } + return cm::nullopt; + } #endif protected: @@ -688,6 +706,7 @@ private: bool TraceExpand = false; TraceFormat TraceFormatVar = TRACE_HUMAN; cmGeneratedFileStream TraceFile; + cmake* TraceRedirect = nullptr; bool WarnUninitialized = false; bool WarnUnusedCli = true; bool CheckSystemVars = false; |