Don't warn if the variable wasn't defined

This commit is contained in:
Ben Boeckel 2010-09-16 13:52:17 -04:00
parent aefc91dd37
commit 995cfb0e2a
1 changed files with 6 additions and 1 deletions

View File

@ -1783,8 +1783,13 @@ void cmMakefile::CheckForUnused(const char* reason, const char* name) const
void cmMakefile::RemoveDefinition(const char* name) void cmMakefile::RemoveDefinition(const char* name)
{ {
this->Internal->VarStack.top().Set(name, 0); this->Internal->VarStack.top().Set(name, 0);
this->Internal->VarInitStack.top().insert(name); if (this->Internal->VarUsageStack.size() &&
this->VariableInitialized(name))
{
this->CheckForUnused("unsetting", name); this->CheckForUnused("unsetting", name);
this->Internal->VarUsageStack.top().erase(name);
}
this->Internal->VarInitStack.top().insert(name);
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch(); cmVariableWatch* vv = this->GetVariableWatch();
if ( vv ) if ( vv )