summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-12-30 20:25:35 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-12-30 20:25:35 (GMT)
commitc690311b76f219b6be7ca9a956ac5ec0882e2cc6 (patch)
tree43cb1e44c9c448d01c866e9296338dfec16bcab2 /Source
parentbb618a7db5fb9df2770c29bc9d86e1c198325504 (diff)
downloadCMake-c690311b76f219b6be7ca9a956ac5ec0882e2cc6.zip
CMake-c690311b76f219b6be7ca9a956ac5ec0882e2cc6.tar.gz
CMake-c690311b76f219b6be7ca9a956ac5ec0882e2cc6.tar.bz2
ENH: Add a way to compare two files
Diffstat (limited to 'Source')
-rw-r--r--Source/cmake.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index b13ca0f..27702d9 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -718,6 +718,7 @@ void CMakeCommandUsage(const char* program)
<< " copy file destination - copy file to destination (either file or directory)\n"
<< " copy_if_different in-file out-file - copy file if input has changed\n"
<< " copy_directory source destination - copy directory 'source' content to directory 'destination'\n"
+ << " compare_files file1 file2 - check if file1 is same as file2\n"
<< " echo [string]... - displays arguments as text\n"
<< " remove file1 file2 ... - remove the file(s)\n"
<< " tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar.\n"
@@ -777,6 +778,19 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
return 0;
}
+ // Compare files
+ if (args[1] == "compare_files" && args.size() == 4)
+ {
+ if(cmSystemTools::FilesDiffer(args[2].c_str(), args[3].c_str()))
+ {
+ std::cerr << "Files \""
+ << args[2].c_str() << "\" to \"" << args[3].c_str()
+ << "\" are different.\n";
+ return 1;
+ }
+ return 0;
+ }
+
// Echo string
else if (args[1] == "echo" )
{