diff options
Diffstat (limited to 'Source/cmWhileCommand.cxx')
-rw-r--r-- | Source/cmWhileCommand.cxx | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 3c785d7..f88ed2b 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -28,7 +28,15 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) } // at end of for each execute recorded commands - if (cmSystemTools::LowerCase(lff.Name) == "endwhile") + if (!cmSystemTools::Strucmp(lff.Name.c_str(),"while")) + { + // record the number of while commands past this one + this->Depth++; + } + else if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endwhile")) + { + // if this is the endwhile for this while loop then execute + if (!this->Depth) { char* errorString = 0; @@ -53,6 +61,12 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) mf.RemoveFunctionBlocker(lff); return true; } + else + { + // decrement for each nested while that ends + this->Depth--; + } + } // record the command this->Functions.push_back(lff); @@ -62,11 +76,12 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) } bool cmWhileFunctionBlocker:: -ShouldRemove(const cmListFileFunction& lff, cmMakefile& ) +ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) { - if(cmSystemTools::LowerCase(lff.Name) == "endwhile") + if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endwhile")) { - if (lff.Arguments == this->Args) + if (lff.Arguments == this->Args + || mf.IsOn("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS")) { return true; } |