cmake: Simplify command clean up loop.

This commit is contained in:
Stephen Kelly 2015-04-12 10:48:17 +02:00
parent 1e738bcf9c
commit 97e53ebb3c
1 changed files with 6 additions and 13 deletions

View File

@ -197,27 +197,20 @@ void cmake::InitializeProperties()
void cmake::CleanupCommandsAndMacros() void cmake::CleanupCommandsAndMacros()
{ {
this->InitializeProperties(); this->InitializeProperties();
std::vector<cmCommand*> commands;
for(RegisteredCommandsMap::iterator j = this->Commands.begin(); for(RegisteredCommandsMap::iterator j = this->Commands.begin();
j != this->Commands.end(); ++j) j != this->Commands.end(); )
{ {
if ( !j->second->IsA("cmMacroHelperCommand") && if (j->second->IsA("cmMacroHelperCommand") ||
!j->second->IsA("cmFunctionHelperCommand")) j->second->IsA("cmFunctionHelperCommand"))
{ {
commands.push_back(j->second); delete j->second;
this->Commands.erase(j++);
} }
else else
{ {
delete j->second; ++j;
} }
} }
this->Commands.clear();
std::vector<cmCommand*>::iterator it;
for ( it = commands.begin(); it != commands.end();
++ it )
{
this->Commands[cmSystemTools::LowerCase((*it)->GetName())] = *it;
}
} }
bool cmake::CommandExists(const std::string& name) const bool cmake::CommandExists(const std::string& name) const