diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-12-04 21:03:19 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-12-04 21:03:19 (GMT) |
commit | 5050706ae393bf2c10a5279ddc23613775ad9b3b (patch) | |
tree | 8d16cccaf3509bd56e20d432d78b1e3400ea2e89 /Source/cmake.cxx | |
parent | ab7f11a23941ffe69d6e9de3c3c35e4835424e5f (diff) | |
download | CMake-5050706ae393bf2c10a5279ddc23613775ad9b3b.zip CMake-5050706ae393bf2c10a5279ddc23613775ad9b3b.tar.gz CMake-5050706ae393bf2c10a5279ddc23613775ad9b3b.tar.bz2 |
ENH: add a touch -E command to cmake
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 82db89e..4eb92ad 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -941,6 +941,8 @@ void CMakeCommandUsage(const char* program) << " 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 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args) } 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) |