diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 265c0d663..e28956fc7 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -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") || diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 757377c5d..fcdbc09de 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -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 Args; bool IsBlocking; bool HasRun; + unsigned int ScopeDepth; }; /** \class cmIfCommand diff --git a/Source/cmSetPropertiesCommand.cxx b/Source/cmSetPropertiesCommand.cxx index 8ac03e71a..e83e28118 100644 --- a/Source/cmSetPropertiesCommand.cxx +++ b/Source/cmSetPropertiesCommand.cxx @@ -167,8 +167,8 @@ bool cmSetPropertiesCommand::InitialPass( if (!ret) { this->SetError(errors.c_str()); + return ret; } - return ret; } break; }