From 217c243db04a21763848ac048edf153cd93bd883 Mon Sep 17 00:00:00 2001
From: Stephen Kelly <steveire@gmail.com>
Date: Sun, 14 Jun 2015 01:08:34 +0200
Subject: cmake: Update the current snapshot when Resetting.

This will matter when definitions are stored in the cmState.
---
 Source/cmState.cxx | 6 ++++--
 Source/cmState.h   | 2 +-
 Source/cmake.cxx   | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index f0c7e6d..58500cc 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -219,13 +219,13 @@ void cmState::RemoveCacheEntryProperty(std::string const& key,
        ->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0);
 }
 
-void cmState::Reset()
+cmState::Snapshot cmState::Reset()
 {
   this->GlobalProperties.clear();
   this->PropertyDefinitions.clear();
 
   this->BuildsystemDirectory.Truncate();
-  this->SnapshotData.Truncate();
+  PositionType pos = this->SnapshotData.Truncate();
 
   this->DefineProperty
     ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
@@ -246,6 +246,8 @@ void cmState::Reset()
   this->DefineProperty
     ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET,
      "", "", true);
+
+  return Snapshot(this, pos);
 }
 
 void cmState::DefineProperty(const std::string& name,
diff --git a/Source/cmState.h b/Source/cmState.h
index 070a08b..9c7574f 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -105,7 +105,7 @@ public:
   void RemoveCacheEntryProperty(std::string const& key,
                                 std::string const& propertyName);
 
-  void Reset();
+  Snapshot Reset();
   // Define a property
   void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
                       const char *ShortDescription,
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index eeb6575..e51b260 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -186,7 +186,7 @@ cmake::~cmake()
 
 void cmake::CleanupCommandsAndMacros()
 {
-  this->State->Reset();
+  this->CurrentSnapshot = this->State->Reset();
   this->State->RemoveUserDefinedCommands();
 }
 
@@ -370,6 +370,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
   // read in the list file to fill the cache
   if(path)
     {
+    this->CurrentSnapshot = this->State->Reset();
     std::string homeDir = this->GetHomeDirectory();
     std::string homeOutputDir = this->GetHomeOutputDirectory();
     this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
-- 
cgit v0.12