[cmake-commits] martink committed cmIfCommand.cxx 1.75 1.76 cmIfCommand.h 1.39 1.40 cmSetPropertiesCommand.cxx 1.6 1.7

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Dec 12 10:07:23 EST 2006


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv29832/Source

Modified Files:
	cmIfCommand.cxx cmIfCommand.h cmSetPropertiesCommand.cxx 
Log Message:
ENH: fix a warning and a nice fix to the IF command


Index: cmSetPropertiesCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSetPropertiesCommand.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cmSetPropertiesCommand.cxx	11 Dec 2006 15:26:10 -0000	1.6
+++ cmSetPropertiesCommand.cxx	12 Dec 2006 15:07:20 -0000	1.7
@@ -167,8 +167,8 @@
       if (!ret)
         {
         this->SetError(errors.c_str());
+        return ret;
         }
-      return ret;
       }
       break;
     }

Index: cmIfCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.cxx,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- cmIfCommand.cxx	7 Dec 2006 14:44:45 -0000	1.75
+++ cmIfCommand.cxx	12 Dec 2006 15:07:20 -0000	1.76
@@ -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") ||

Index: cmIfCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- cmIfCommand.h	23 Oct 2006 21:14:19 -0000	1.39
+++ cmIfCommand.h	12 Dec 2006 15:07:20 -0000	1.40
@@ -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 @@
   std::vector<cmListFileArgument> Args;
   bool IsBlocking;
   bool HasRun;
+  unsigned int ScopeDepth;
 };
 
 /** \class cmIfCommand



More information about the Cmake-commits mailing list