diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 6c261f4de5..81f53c2a5e 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -282,16 +282,12 @@ cmStateSnapshot cmState::Reset() { cmLinkedTree::iterator it = this->BuildsystemDirectory.Truncate(); - it->IncludeDirectories.clear(); - it->CompileDefinitions.clear(); - it->CompileOptions.clear(); - it->LinkOptions.clear(); - it->LinkDirectories.clear(); - it->CurrentScope = pos; - it->NormalTargetNames.clear(); - it->ImportedTargetNames.clear(); - it->Properties.Clear(); - it->Children.clear(); + + cmStateDetail::BuildsystemDirectoryStateType newState; + newState.Location = std::move(it->Location); + newState.OutputLocation = std::move(it->OutputLocation); + newState.CurrentScope = pos; + *it = std::move(newState); } this->PolicyStack.Clear();