summaryrefslogtreecommitdiffstats
path: root/Source/cmIfCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-10-23 17:37:24 (GMT)
committerBrad King <brad.king@kitware.com>2006-10-23 17:37:24 (GMT)
commitd1a9c93119958a1a394fe0dde5814cd6a8f3f748 (patch)
treecf2adb57d85858bb4ecca2fe3e288a1fdcb8a979 /Source/cmIfCommand.cxx
parent0c52510f21fdddf289735aa30a0df9671d63970a (diff)
downloadCMake-d1a9c93119958a1a394fe0dde5814cd6a8f3f748.zip
CMake-d1a9c93119958a1a394fe0dde5814cd6a8f3f748.tar.gz
CMake-d1a9c93119958a1a394fe0dde5814cd6a8f3f748.tar.bz2
ENH: Patch from Alex to provide nicer syntax for FILE_IS_NEWER. Using name IS_NEWER_THAN so old syntax will continue to work.
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r--Source/cmIfCommand.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 722cc78..1553171 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -493,6 +493,29 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
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;
}
}