Merge topic 'fix-command-rename'
d4f032b5
cmState: Restore renamed commands on cleanup.
This commit is contained in:
commit
e30fe3eba2
|
@ -430,6 +430,7 @@ std::vector<std::string> cmState::GetCommandNames() const
|
||||||
|
|
||||||
void cmState::RemoveUserDefinedCommands()
|
void cmState::RemoveUserDefinedCommands()
|
||||||
{
|
{
|
||||||
|
std::vector<cmCommand*> renamedCommands;
|
||||||
for(std::map<std::string, cmCommand*>::iterator j = this->Commands.begin();
|
for(std::map<std::string, cmCommand*>::iterator j = this->Commands.begin();
|
||||||
j != this->Commands.end(); )
|
j != this->Commands.end(); )
|
||||||
{
|
{
|
||||||
|
@ -439,11 +440,21 @@ void cmState::RemoveUserDefinedCommands()
|
||||||
delete j->second;
|
delete j->second;
|
||||||
this->Commands.erase(j++);
|
this->Commands.erase(j++);
|
||||||
}
|
}
|
||||||
|
else if (j->first != j->second->GetName())
|
||||||
|
{
|
||||||
|
renamedCommands.push_back(j->second);
|
||||||
|
this->Commands.erase(j++);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
++j;
|
++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)
|
void cmState::SetGlobalProperty(const std::string& prop, const char* value)
|
||||||
|
|
|
@ -4,6 +4,13 @@
|
||||||
cmake_minimum_required(VERSION 2.4)
|
cmake_minimum_required(VERSION 2.4)
|
||||||
project (Complex)
|
project (Complex)
|
||||||
|
|
||||||
|
# Test that renaming a built-in works when configured multiple times.
|
||||||
|
message("message")
|
||||||
|
function(message)
|
||||||
|
_message(${ARGN})
|
||||||
|
endfunction()
|
||||||
|
message("message")
|
||||||
|
|
||||||
# Try setting a new policy. The IF test is for coverage.
|
# Try setting a new policy. The IF test is for coverage.
|
||||||
if(POLICY CMP0003)
|
if(POLICY CMP0003)
|
||||||
cmake_policy(SET CMP0003 NEW)
|
cmake_policy(SET CMP0003 NEW)
|
||||||
|
|
Loading…
Reference in New Issue