[cmake-commits] king committed cmIfCommand.cxx 1.69 1.70 cmIfCommand.h 1.37 1.38

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Oct 23 13:37:27 EDT 2006


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

Modified Files:
	cmIfCommand.cxx cmIfCommand.h 
Log Message:
ENH: Patch from Alex to provide nicer syntax for FILE_IS_NEWER.  Using name IS_NEWER_THAN so old syntax will continue to work.


Index: cmIfCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.cxx,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- cmIfCommand.cxx	22 Sep 2006 15:23:51 -0000	1.69
+++ cmIfCommand.cxx	23 Oct 2006 17:37:24 -0000	1.70
@@ -493,6 +493,29 @@
         reducible = 1;
         }
 
+      // is file A newer than file B
+      if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
+          *(argP1) == "IS_NEWER_THAN")
+        {
+        int fileIsNewer=0;
+        bool success=cmSystemTools::FileTimeCompare(arg->c_str(),
+            (argP2)->c_str(),
+            &fileIsNewer);
+        if(success==false || fileIsNewer==1 || fileIsNewer==0)
+          {
+          *arg = "1";
+          }
+        else
+          {
+          *arg = "0";
+          }
+        newArgs.erase(argP2);
+        newArgs.erase(argP1);
+        argP1 = arg;
+        IncrementArguments(newArgs,argP1,argP2);
+        reducible = 1;
+        }
+
       ++arg;
       }
     }

Index: cmIfCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- cmIfCommand.h	22 Sep 2006 15:23:51 -0000	1.37
+++ cmIfCommand.h	23 Oct 2006 17:37:24 -0000	1.38
@@ -130,6 +130,7 @@
       "True if the named file or directory exists.  "
       "Behavior is well-defined only for full paths.\n"
       "  IF(FILE_IS_NEWER file1 file2)\n"
+      "  IF(file1 IS_NEWER_THAN file2)\n"
       "True if file1 is newer than file2 or if one of the two files "
       "doesn't exist. "
       "Behavior is well-defined only for full paths.\n"



More information about the Cmake-commits mailing list