From f5fa6d53b07d5c6224de2a491856a36fe3516218 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Tue, 4 May 2021 13:57:47 +0200 Subject: class cmake: Store working directory at cmake launch --- Source/cmake.cxx | 3 ++- Source/cmake.h | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 6123497..5440984 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -157,7 +157,8 @@ static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, #endif cmake::cmake(Role role, cmState::Mode mode) - : FileTimeCache(cm::make_unique()) + : CMakeWorkingDirectory(cmSystemTools::GetCurrentWorkingDirectory()) + , FileTimeCache(cm::make_unique()) #ifndef CMAKE_BOOTSTRAP , VariableWatch(cm::make_unique()) #endif diff --git a/Source/cmake.h b/Source/cmake.h index 9b29098..e845662 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -194,6 +194,14 @@ public: //@} /** + * Working directory at CMake launch + */ + std::string const& GetCMakeWorkingDirectory() const + { + return this->CMakeWorkingDirectory; + } + + /** * Handle a command line invocation of cmake. */ int Run(const std::vector& args) @@ -628,6 +636,7 @@ protected: void GenerateGraphViz(const std::string& fileName) const; private: + std::string CMakeWorkingDirectory; ProgressCallbackType ProgressCallback; WorkingMode CurrentWorkingMode = NORMAL_MODE; bool DebugOutput = false; -- cgit v0.12