summaryrefslogtreecommitdiffstats
path: root/Source/cmIfCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2006-12-12 15:07:20 (GMT)
committerKen Martin <ken.martin@kitware.com>2006-12-12 15:07:20 (GMT)
commit372ce05a07a5c6c7e1893e7b47922c1292d2a6de (patch)
tree19d9aba4354628ec12799c8e8a57f4f8c5ef8be7 /Source/cmIfCommand.cxx
parent97eceffa232f615f7352e871ff35c2de0f498db4 (diff)
downloadCMake-372ce05a07a5c6c7e1893e7b47922c1292d2a6de.zip
CMake-372ce05a07a5c6c7e1893e7b47922c1292d2a6de.tar.gz
CMake-372ce05a07a5c6c7e1893e7b47922c1292d2a6de.tar.bz2
ENH: fix a warning and a nice fix to the IF command
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r--Source/cmIfCommand.cxx22
1 files changed, 18 insertions, 4 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") ||