ENH: fix a warning and a nice fix to the IF command

This commit is contained in:
Ken Martin 2006-12-12 10:07:20 -05:00
parent 97eceffa23
commit 372ce05a07
3 changed files with 21 additions and 6 deletions

View File

@ -22,10 +22,24 @@
bool cmIfFunctionBlocker::
IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
{
// always let if statements through
// if we are blocking then all we need to do is keep track of
// scope depth of nested if statements
if (this->IsBlocking)
{
if (!cmSystemTools::Strucmp(lff.Name.c_str(),"if"))
{
return false;
this->ScopeDepth++;
return true;
}
}
if (this->IsBlocking && this->ScopeDepth)
{
if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endif"))
{
this->ScopeDepth--;
}
return true;
}
// watch for our ELSE or ENDIF

View File

@ -28,7 +28,7 @@
class cmIfFunctionBlocker : public cmFunctionBlocker
{
public:
cmIfFunctionBlocker() {this->HasRun = false;}
cmIfFunctionBlocker() {this->HasRun = false; this->ScopeDepth = 0;}
virtual ~cmIfFunctionBlocker() {}
virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
cmMakefile &mf);
@ -39,6 +39,7 @@ public:
std::vector<cmListFileArgument> Args;
bool IsBlocking;
bool HasRun;
unsigned int ScopeDepth;
};
/** \class cmIfCommand

View File

@ -167,9 +167,9 @@ bool cmSetPropertiesCommand::InitialPass(
if (!ret)
{
this->SetError(errors.c_str());
}
return ret;
}
}
break;
}