summaryrefslogtreecommitdiffstats
path: root/Source/cmState.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-07-11 08:51:36 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-07-12 08:09:54 (GMT)
commitd4f032b5460afce396dcc5ce3b0af9eb0619812b (patch)
tree7d9a2e205b6081a28cc74748e1dd74a0f84ec962 /Source/cmState.cxx
parentb37fb49646909b489a062088ed5aa1e88d896f83 (diff)
downloadCMake-d4f032b5460afce396dcc5ce3b0af9eb0619812b.zip
CMake-d4f032b5460afce396dcc5ce3b0af9eb0619812b.tar.gz
CMake-d4f032b5460afce396dcc5ce3b0af9eb0619812b.tar.bz2
cmState: Restore renamed commands on cleanup.
Commit v3.3.0-rc1~196^2~7 (cmake: Simplify command clean up loop., 2015-04-12) introduced a bug that built-in commands which were renamed no longer had their original name restored when cleanup is performed between configure runs. Check for that and restore the commands with their original name. Extend the complex test for this. That test is run by ctest with the --build-two-config command line option.
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r--Source/cmState.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 58885d3..042fabe 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -406,6 +406,7 @@ std::vector<std::string> cmState::GetCommandNames() const
void cmState::RemoveUserDefinedCommands()
{
+ std::vector<cmCommand*> renamedCommands;
for(std::map<std::string, cmCommand*>::iterator j = this->Commands.begin();
j != this->Commands.end(); )
{
@@ -415,11 +416,21 @@ void cmState::RemoveUserDefinedCommands()
delete j->second;
this->Commands.erase(j++);
}
+ else if (j->first != j->second->GetName())
+ {
+ renamedCommands.push_back(j->second);
+ this->Commands.erase(j++);
+ }
else
{
++j;
}
}
+ for (std::vector<cmCommand*>::const_iterator it = renamedCommands.begin();
+ it != renamedCommands.end(); ++it)
+ {
+ this->Commands[cmSystemTools::LowerCase((*it)->GetName())] = *it;
+ }
}
void cmState::SetGlobalProperty(const std::string& prop, const char* value)