summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmIfCommand.cxx23
-rw-r--r--Source/cmIfCommand.h1
2 files changed, 24 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;
}
}
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index 1d07248..c7044a3 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -130,6 +130,7 @@ public:
"True if the named file or directory exists. "
"Behavior is well-defined only for full paths.\n"
" IF(FILE_IS_NEWER file1 file2)\n"
+ " IF(file1 IS_NEWER_THAN file2)\n"
"True if file1 is newer than file2 or if one of the two files "
"doesn't exist. "
"Behavior is well-defined only for full paths.\n"