ENH: fix a warning and a nice fix to the IF command
This commit is contained in:
parent
97eceffa23
commit
372ce05a07
@ -22,10 +22,24 @@
|
|||||||
bool cmIfFunctionBlocker::
|
bool cmIfFunctionBlocker::
|
||||||
IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
|
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"))
|
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
|
// watch for our ELSE or ENDIF
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
class cmIfFunctionBlocker : public cmFunctionBlocker
|
class cmIfFunctionBlocker : public cmFunctionBlocker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmIfFunctionBlocker() {this->HasRun = false;}
|
cmIfFunctionBlocker() {this->HasRun = false; this->ScopeDepth = 0;}
|
||||||
virtual ~cmIfFunctionBlocker() {}
|
virtual ~cmIfFunctionBlocker() {}
|
||||||
virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
|
virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
|
||||||
cmMakefile &mf);
|
cmMakefile &mf);
|
||||||
@ -39,6 +39,7 @@ public:
|
|||||||
std::vector<cmListFileArgument> Args;
|
std::vector<cmListFileArgument> Args;
|
||||||
bool IsBlocking;
|
bool IsBlocking;
|
||||||
bool HasRun;
|
bool HasRun;
|
||||||
|
unsigned int ScopeDepth;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \class cmIfCommand
|
/** \class cmIfCommand
|
||||||
|
@ -167,9 +167,9 @@ bool cmSetPropertiesCommand::InitialPass(
|
|||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
this->SetError(errors.c_str());
|
this->SetError(errors.c_str());
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user