Browse Source

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.
Brad King 15 years ago
parent
commit
a4335a621e
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Source/cmake.cxx

+ 5 - 2
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
 }