Commit d4f032b5 authored by Stephen Kelly's avatar Stephen Kelly

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.
parent b37fb496
......@@ -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;
else if (j->first != j->second->GetName())
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)
......@@ -4,6 +4,13 @@
cmake_minimum_required(VERSION 2.4)
project (Complex)
# Test that renaming a built-in works when configured multiple times.
# Try setting a new policy. The IF test is for coverage.
if(POLICY CMP0003)
cmake_policy(SET CMP0003 NEW)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment