diff options
Diffstat (limited to 'Source/cmake.h')
-rw-r--r-- | Source/cmake.h | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/Source/cmake.h b/Source/cmake.h index 3183577..10db87d 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -18,6 +18,7 @@ #include <cm/string_view> #include <cmext/string_view> +#include "cmDocumentationEntry.h" #include "cmGeneratedFileStream.h" #include "cmInstalledFile.h" #include "cmListFileCache.h" @@ -33,21 +34,19 @@ # include <cm3p/json/value.h> # include "cmCMakePresetsGraph.h" +# include "cmMakefileProfilingData.h" #endif +class cmConfigureLog; class cmExternalMakefileProjectGeneratorFactory; class cmFileAPI; class cmFileTimeCache; class cmGlobalGenerator; class cmGlobalGeneratorFactory; class cmMakefile; -#if !defined(CMAKE_BOOTSTRAP) -class cmMakefileProfilingData; -#endif class cmMessenger; class cmVariableWatch; struct cmBuildOptions; -struct cmDocumentationEntry; /** \brief Represents a cmake invocation. * @@ -513,10 +512,23 @@ 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(); +#ifndef CMAKE_BOOTSTRAP + cmConfigureLog* GetConfigureLog() const { return this->ConfigureLog.get(); } +#endif + + //! 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 +642,24 @@ public: #if !defined(CMAKE_BOOTSTRAP) cmMakefileProfilingData& GetProfilingOutput(); bool IsProfilingEnabled() const; + + cm::optional<cmMakefileProfilingData::RAII> CreateProfilingEntry( + const std::string& category, const std::string& name) + { + return this->CreateProfilingEntry( + category, name, []() -> cm::nullopt_t { return cm::nullopt; }); + } + + template <typename ArgsFunc> + cm::optional<cmMakefileProfilingData::RAII> CreateProfilingEntry( + const std::string& category, const std::string& name, ArgsFunc&& argsFunc) + { + if (this->IsProfilingEnabled()) { + return cm::make_optional<cmMakefileProfilingData::RAII>( + this->GetProfilingOutput(), category, name, argsFunc()); + } + return cm::nullopt; + } #endif protected: @@ -688,6 +718,10 @@ private: bool TraceExpand = false; TraceFormat TraceFormatVar = TRACE_HUMAN; cmGeneratedFileStream TraceFile; + cmake* TraceRedirect = nullptr; +#ifndef CMAKE_BOOTSTRAP + std::unique_ptr<cmConfigureLog> ConfigureLog; +#endif bool WarnUninitialized = false; bool WarnUnusedCli = true; bool CheckSystemVars = false; @@ -767,37 +801,10 @@ private: #if !defined(CMAKE_BOOTSTRAP) std::unique_ptr<cmMakefileProfilingData> ProfilingOutput; #endif -}; -#define CMAKE_STANDARD_OPTIONS_TABLE \ - { "-S <path-to-source>", "Explicitly specify a source directory." }, \ - { "-B <path-to-build>", "Explicitly specify a build directory." }, \ - { "-C <initial-cache>", "Pre-load a script to populate the cache." }, \ - { "-D <var>[:<type>]=<value>", "Create or update a cmake cache entry." }, \ - { "-U <globbing_expr>", "Remove matching entries from CMake cache." }, \ - { "-G <generator-name>", "Specify a build system generator." }, \ - { "-T <toolset-name>", \ - "Specify toolset name if supported by generator." }, \ - { "-A <platform-name>", \ - "Specify platform name if supported by generator." }, \ - { "--toolchain <file>", \ - "Specify toolchain file [CMAKE_TOOLCHAIN_FILE]." }, \ - { "--install-prefix <directory>", \ - "Specify install directory [CMAKE_INSTALL_PREFIX]." }, \ - { "-Wdev", "Enable developer warnings." }, \ - { "-Wno-dev", "Suppress developer warnings." }, \ - { "-Werror=dev", "Make developer warnings errors." }, \ - { "-Wno-error=dev", "Make developer warnings not errors." }, \ - { "-Wdeprecated", "Enable deprecation warnings." }, \ - { "-Wno-deprecated", "Suppress deprecation warnings." }, \ - { "-Werror=deprecated", \ - "Make deprecated macro and function warnings " \ - "errors." }, \ - { \ - "-Wno-error=deprecated", \ - "Make deprecated macro and function warnings " \ - "not errors." \ - } +public: + static cmDocumentationEntry CMAKE_STANDARD_OPTIONS_TABLE[18]; +}; #define FOR_EACH_C90_FEATURE(F) F(c_function_prototypes) |