diff options
-rw-r--r-- | Source/cmIfCommand.cxx | 22 | ||||
-rw-r--r-- | Source/cmIfCommand.h | 3 | ||||
-rw-r--r-- | Source/cmSetPropertiesCommand.cxx | 2 |
3 files changed, 21 insertions, 6 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 265c0d6..e28956f 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 757377c..fcdbc09 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<cmListFileArgument> Args; bool IsBlocking; bool HasRun; + unsigned int ScopeDepth; }; /** \class cmIfCommand diff --git a/Source/cmSetPropertiesCommand.cxx b/Source/cmSetPropertiesCommand.cxx index 8ac03e7..e83e281 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; } |