diff options
author | Ken Martin <ken.martin@kitware.com> | 2002-07-10 15:38:38 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2002-07-10 15:38:38 (GMT) |
commit | 32ad30e883bb8661d3fe5e6f0d969fc821c5f512 (patch) | |
tree | 0cad40c56a508980a6976390e984046b68d8298c /Source/cmIfCommand.cxx | |
parent | 9f6ebe4eb7d1294569cda4eb88f01ca7ae0e6815 (diff) | |
download | CMake-32ad30e883bb8661d3fe5e6f0d969fc821c5f512.zip CMake-32ad30e883bb8661d3fe5e6f0d969fc821c5f512.tar.gz CMake-32ad30e883bb8661d3fe5e6f0d969fc821c5f512.tar.bz2 |
better error handling with if statements
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r-- | Source/cmIfCommand.cxx | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 5d207d4..4ad0b42 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -44,14 +44,21 @@ IsFunctionBlocked(const char *name, const std::vector<std::string> &args, cmSystemTools::Error(err.c_str()); } } - return true; + return m_IsBlocking; } bool cmIfFunctionBlocker:: ShouldRemove(const char *name, const std::vector<std::string> &args, cmMakefile &mf) { - return !this->IsFunctionBlocked(name,args,mf); + if (!strcmp(name,"ELSE") || !strcmp(name,"ENDIF")) + { + if (args == m_Args) + { + return true; + } + } + return false; } void cmIfFunctionBlocker:: @@ -80,17 +87,15 @@ bool cmIfCommand::InitialPass(std::vector<std::string> const& args) return false; } - // if is isn't true create a blocker - if (!isTrue) - { - cmIfFunctionBlocker *f = new cmIfFunctionBlocker(); - for(std::vector<std::string>::const_iterator j = args.begin(); - j != args.end(); ++j) - { - f->m_Args.push_back(*j); - } - m_Makefile->AddFunctionBlocker(f); + cmIfFunctionBlocker *f = new cmIfFunctionBlocker(); + // if is isn't true block the commands + f->m_IsBlocking = !isTrue; + for(std::vector<std::string>::const_iterator j = args.begin(); + j != args.end(); ++j) + { + f->m_Args.push_back(*j); } + m_Makefile->AddFunctionBlocker(f); return true; } |