diff options
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) |