ENH: fix a warning and a nice fix to the IF command
This commit is contained in:
parent
97eceffa23
commit
372ce05a07
|
@ -22,12 +22,26 @@
|
|||
bool cmIfFunctionBlocker::
|
||||
IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
|
||||
{
|
||||
// always let if statements through
|
||||
if (!cmSystemTools::Strucmp(lff.Name.c_str(),"if"))
|
||||
// if we are blocking then all we need to do is keep track of
|
||||
// scope depth of nested if statements
|
||||
if (this->IsBlocking)
|
||||
{
|
||||
return false;
|
||||
if (!cmSystemTools::Strucmp(lff.Name.c_str(),"if"))
|
||||
{
|
||||
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
|
||||
if (!cmSystemTools::Strucmp(lff.Name.c_str(),"else") ||
|
||||
!cmSystemTools::Strucmp(lff.Name.c_str(),"elseif") ||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -167,8 +167,8 @@ bool cmSetPropertiesCommand::InitialPass(
|
|||
if (!ret)
|
||||
{
|
||||
this->SetError(errors.c_str());
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue