[cmake-commits] hoffman committed cmake.cxx 1.335 1.336

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Dec 4 16:03:21 EST 2007


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

Modified Files:
	cmake.cxx 
Log Message:
ENH: add a touch -E command to cmake


Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.335
retrieving revision 1.336
diff -u -d -r1.335 -r1.336
--- cmake.cxx	3 Dec 2007 18:35:33 -0000	1.335
+++ cmake.cxx	4 Dec 2007 21:03:18 -0000	1.336
@@ -941,6 +941,8 @@
     << "  tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar "
        "archive\n"
     << "  time command [args] ...   - run command and return elapsed time\n"
+    << "  touch file                - touch a file.\n"
+    << "  touch_nocreate file       - touch a file but do not create it.\n"
 #if defined(_WIN32) && !defined(__CYGWIN__)
     << "  write_regv key value      - write registry value\n"
     << "  delete_regv key           - delete registry value\n"
@@ -1096,6 +1098,34 @@
         }
       return 0;
       }
+    // Touch file
+    else if (args[1] == "touch" && args.size() > 2)
+      {
+      for (std::string::size_type cc = 2; cc < args.size(); cc ++)
+        {
+        // Complain if the file could not be removed, still exists,
+        // and the -f option was not given.
+        if(!cmSystemTools::Touch(args[cc].c_str(), true))
+          {
+          return 1;
+          }
+        }
+      return 0;
+      }
+    // Touch file
+    else if (args[1] == "touch_nocreate" && args.size() > 2)
+      {
+      for (std::string::size_type cc = 2; cc < args.size(); cc ++)
+        {
+        // Complain if the file could not be removed, still exists,
+        // and the -f option was not given.
+        if(!cmSystemTools::Touch(args[cc].c_str(), false))
+          {
+          return 1;
+          }
+        }
+      return 0;
+      }
 
     // Clock command
     else if (args[1] == "time" && args.size() > 2)



More information about the Cmake-commits mailing list