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.
This commit is contained in:
Brad King 2011-03-24 09:44:23 -04:00
parent a75ebe3ea4
commit a4335a621e
1 changed files with 5 additions and 2 deletions

View File

@ -4306,7 +4306,10 @@ void cmake::WatchUnusedCli(const char* var)
{ {
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this); this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this);
this->UsedCliVariables[var] = false; if(this->UsedCliVariables.find(var) == this->UsedCliVariables.end())
{
this->UsedCliVariables[var] = false;
}
#endif #endif
} }
@ -4314,7 +4317,7 @@ void cmake::UnwatchUnusedCli(const char* var)
{ {
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
this->VariableWatch->RemoveWatch(var, cmWarnUnusedCliWarning); this->VariableWatch->RemoveWatch(var, cmWarnUnusedCliWarning);
this->UsedCliVariables[var] = true; this->UsedCliVariables.erase(var);
#endif #endif
} }