diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-24 11:00:20 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-05-24 11:30:24 (GMT) |
commit | 01e1cd5c1fc5e2684ec69d4916dd31ed23746055 (patch) | |
tree | 554d47feea8bc7a28abb753df88ab108c9997c9b /Source/cmLocalGenerator.cxx | |
parent | f69dcdfc380176a2c4365357c1ca85c0444087b0 (diff) | |
download | CMake-01e1cd5c1fc5e2684ec69d4916dd31ed23746055.zip CMake-01e1cd5c1fc5e2684ec69d4916dd31ed23746055.tar.gz CMake-01e1cd5c1fc5e2684ec69d4916dd31ed23746055.tar.bz2 |
cmState: Move snapshot creation to the cmake instance.
Don't create a snapshot in Initialize(), but leave the creation
responsibility to the cmake instance instead. Previously, the
cmState would Initialize() in its constructor, and the cmake instance
would re-Initialize() during Configure(). The end result was the
same and there would be one snapshot present. However, cmLocalGenerator
also created a snapshot on construction, and that one was used, leaving
the first snapshot unused, and potential for off-by-one errors.
Fix that by making the cmLocalGenerator use the existing snapshot
if it is top-level. Add a CurrentSnapshot to the cmake instance and
populated it while configuring a directory. This will eventually
replace the 'current local generator' concept. Fix the GetParent
implementation to be able to return the first snapshot.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c2e996c..442b9bf 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -56,9 +56,9 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, } else { - this->StateSnapshot = - this->GetState()->CreateSnapshot(cmState::Snapshot(this->GetState())); + this->StateSnapshot = gg->GetCMakeInstance()->GetCurrentSnapshot(); } + this->Makefile = new cmMakefile(this); this->LinkScriptShell = false; @@ -84,11 +84,14 @@ class cmLocalGeneratorCurrent { cmGlobalGenerator* GG; cmLocalGenerator* LG; + cmState::Snapshot Snapshot; public: cmLocalGeneratorCurrent(cmLocalGenerator* lg) { this->GG = lg->GetGlobalGenerator(); this->LG = this->GG->GetCurrentLocalGenerator(); + this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); + this->GG->GetCMakeInstance()->SetCurrentSnapshot(lg->GetStateSnapshot()); this->GG->SetCurrentLocalGenerator(lg); #if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PushFileScope(); @@ -100,6 +103,7 @@ public: this->GG->GetFileLockPool().PopFileScope(); #endif this->GG->SetCurrentLocalGenerator(this->LG); + this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); } }; |