diff options
author | Brad King <brad.king@kitware.com> | 2015-07-13 13:17:46 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-07-13 13:17:46 (GMT) |
commit | e30fe3eba211056491f832d469a5176653071c9e (patch) | |
tree | 5c0e4b13fae486a925f2fb38b0506b04fae4c87c | |
parent | 93bd1540756ec9cfb60cf9bbac57beedf9bd3433 (diff) | |
parent | d4f032b5460afce396dcc5ce3b0af9eb0619812b (diff) | |
download | CMake-e30fe3eba211056491f832d469a5176653071c9e.zip CMake-e30fe3eba211056491f832d469a5176653071c9e.tar.gz CMake-e30fe3eba211056491f832d469a5176653071c9e.tar.bz2 |
Merge topic 'fix-command-rename'
d4f032b5 cmState: Restore renamed commands on cleanup.
-rw-r--r-- | Source/cmState.cxx | 11 | ||||
-rw-r--r-- | Tests/Complex/CMakeLists.txt | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index d918f65..2d8b935 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -430,6 +430,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(); ) { @@ -439,11 +440,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) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 5e5eead..9251ff3 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -4,6 +4,13 @@ cmake_minimum_required(VERSION 2.4) 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. if(POLICY CMP0003) cmake_policy(SET CMP0003 NEW) |