diff options
author | Ken Martin <ken.martin@kitware.com> | 2006-05-18 17:50:01 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2006-05-18 17:50:01 (GMT) |
commit | 29a03db7ce5150c30610d4a9b0e7c6d38f923f35 (patch) | |
tree | 283a237abcb57f0a2af8b3a4f8f4c0019f190188 /Source/cmIfCommand.cxx | |
parent | 095e975c812c7962fa865f04444ac489f1ee8643 (diff) | |
download | CMake-29a03db7ce5150c30610d4a9b0e7c6d38f923f35.zip CMake-29a03db7ce5150c30610d4a9b0e7c6d38f923f35.tar.gz CMake-29a03db7ce5150c30610d4a9b0e7c6d38f923f35.tar.bz2 |
ENH: allow loose loop constructs
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r-- | Source/cmIfCommand.cxx | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 4e7c777..d2c3b7d 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -34,53 +34,34 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) if (cmSystemTools::LowerCase(lff.Name) == "else" || cmSystemTools::LowerCase(lff.Name) == "endif") { - if (args == this->Args) - { - // if it was an else statement then we should change state - // and block this Else Command - if (cmSystemTools::LowerCase(lff.Name) == "else") + // if it was an else statement then we should change state + // and block this Else Command + if (cmSystemTools::LowerCase(lff.Name) == "else") { this->IsBlocking = !this->IsBlocking; return true; } - // otherwise it must be an ENDIF statement, in that case remove the - // function blocker - mf.RemoveFunctionBlocker(lff); - return true; - } - else if(args.empty()) - { - std::string err = "Empty arguments for "; - err += name; - err += ". Did you mean "; - err += name; - err += "( "; - for(std::vector<cmListFileArgument>::const_iterator a = - this->Args.begin(); - a != this->Args.end();++a) - { - err += (a->Quoted?"\"":""); - err += a->Value; - err += (a->Quoted?"\"":""); - err += " "; - } - err += ")?"; - cmSystemTools::Error(err.c_str()); - } - } + // otherwise it must be an ENDIF statement, in that case remove the + // function blocker + mf.RemoveFunctionBlocker(lff); + return true; + } + return this->IsBlocking; } bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff, - cmMakefile&) + cmMakefile& mf) { if (cmSystemTools::LowerCase(lff.Name) == "endif") { - if (lff.Arguments == this->Args) + if (mf.IsOn("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS") + || lff.Arguments == this->Args) { return true; } } + return false; } |