diff options
author | Brad King <brad.king@kitware.com> | 2021-07-02 18:12:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-07-12 16:21:44 (GMT) |
commit | 2065bd73cb6a9a3bc463c5bb0dc6877433782973 (patch) | |
tree | 9df9d27f4fb78bbd86dcdd9659241fe96eec9cff /Source | |
parent | c9cd039e5f312f2717c6522ac7117791856f734b (diff) | |
download | CMake-2065bd73cb6a9a3bc463c5bb0dc6877433782973.zip CMake-2065bd73cb6a9a3bc463c5bb0dc6877433782973.tar.gz CMake-2065bd73cb6a9a3bc463c5bb0dc6877433782973.tar.bz2 |
cmState: Construct with mode
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 2 | ||||
-rw-r--r-- | Source/cmState.cxx | 12 | ||||
-rw-r--r-- | Source/cmState.h | 15 | ||||
-rw-r--r-- | Source/cmake.cxx | 3 |
4 files changed, 13 insertions, 19 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 72b86c1..b60a664 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2165,7 +2165,7 @@ bool cmCTestTestHandler::SetTestsProperties( // Ensure we have complete triples otherwise the data is corrupt. if (triples.size() % 3 == 0) { - cmState state; + cmState state(cmState::Unknown); rt.Backtrace = cmListFileBacktrace(state.CreateBaseSnapshot()); // the first entry represents the top of the trace so we need to diff --git a/Source/cmState.cxx b/Source/cmState.cxx index ce6eb31..b235abd 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -26,7 +26,8 @@ #include "cmSystemTools.h" #include "cmake.h" -cmState::cmState() +cmState::cmState(Mode mode) + : StateMode(mode) { this->CacheManager = cm::make_unique<cmCacheManager>(); this->GlobVerificationManager = cm::make_unique<cmGlobVerificationManager>(); @@ -771,17 +772,12 @@ unsigned int cmState::GetCacheMinorVersion() const cmState::Mode cmState::GetMode() const { - return this->CurrentMode; + return this->StateMode; } std::string cmState::GetModeString() const { - return ModeToString(this->CurrentMode); -} - -void cmState::SetMode(cmState::Mode mode) -{ - this->CurrentMode = mode; + return ModeToString(this->StateMode); } std::string cmState::ModeToString(cmState::Mode mode) diff --git a/Source/cmState.h b/Source/cmState.h index 9951b9a..c7f6a1e 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -35,12 +35,6 @@ class cmState friend class cmStateSnapshot; public: - cmState(); - ~cmState(); - - cmState(const cmState&) = delete; - cmState& operator=(const cmState&) = delete; - enum Mode { Unknown, @@ -51,6 +45,12 @@ public: CPack, }; + cmState(Mode mode); + ~cmState(); + + cmState(const cmState&) = delete; + cmState& operator=(const cmState&) = delete; + static const std::string& GetTargetTypeName( cmStateEnums::TargetType targetType); @@ -207,7 +207,6 @@ public: Mode GetMode() const; std::string GetModeString() const; - void SetMode(Mode mode); static std::string ModeToString(Mode mode); @@ -258,5 +257,5 @@ private: bool NMake = false; bool MSYSShell = false; bool NinjaMulti = false; - Mode CurrentMode = Unknown; + Mode StateMode = Unknown; }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 73f5ad5..a2b2571 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -162,11 +162,10 @@ cmake::cmake(Role role, cmState::Mode mode) #ifndef CMAKE_BOOTSTRAP , VariableWatch(cm::make_unique<cmVariableWatch>()) #endif - , State(cm::make_unique<cmState>()) + , State(cm::make_unique<cmState>(mode)) , Messenger(cm::make_unique<cmMessenger>()) { this->TraceFile.close(); - this->State->SetMode(mode); this->CurrentSnapshot = this->State->CreateBaseSnapshot(); #ifdef __APPLE__ |