From a4335a621eabd74645dfdb6b0c731a6d354fcd30 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 24 Mar 2011 09:44:23 -0400 Subject: [PATCH] Fix unused cache warning after multiple configure iterations The curses dialog (ccmake) allows variables to be specified on the command line. If any of these variables is used during any configure iteration or during generate we must not warn about it. The Qt dialog (cmake-gui) allows variables to be added and removed in the GUI interactively. If a variable is added, removed, and then added again we must still warn if it is unused. --- Source/cmake.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 221a2f3ba..7f7ca97ca 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -4306,7 +4306,10 @@ void cmake::WatchUnusedCli(const char* var) { #ifdef CMAKE_BUILD_WITH_CMAKE this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this); - this->UsedCliVariables[var] = false; + if(this->UsedCliVariables.find(var) == this->UsedCliVariables.end()) + { + this->UsedCliVariables[var] = false; + } #endif } @@ -4314,7 +4317,7 @@ void cmake::UnwatchUnusedCli(const char* var) { #ifdef CMAKE_BUILD_WITH_CMAKE this->VariableWatch->RemoveWatch(var, cmWarnUnusedCliWarning); - this->UsedCliVariables[var] = true; + this->UsedCliVariables.erase(var); #endif }