summaryrefslogtreecommitdiffstats
path: root/Source/cmIfCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2006-03-22 19:06:52 (GMT)
committerKen Martin <ken.martin@kitware.com>2006-03-22 19:06:52 (GMT)
commit10efe3b079caf5237e01d31b09f7947c77c7458f (patch)
tree4df9c11b285a62fdeb1c7868520e9303f95fd26e /Source/cmIfCommand.cxx
parent43b9f184c2f9cacce2917577f9469f71f64885c5 (diff)
downloadCMake-10efe3b079caf5237e01d31b09f7947c77c7458f.zip
CMake-10efe3b079caf5237e01d31b09f7947c77c7458f.tar.gz
CMake-10efe3b079caf5237e01d31b09f7947c77c7458f.tar.bz2
ENH: added some new functionality
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r--Source/cmIfCommand.cxx28
1 files changed, 22 insertions, 6 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index c7b8d2a..bd608f8 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -156,17 +156,17 @@ namespace
// order of operations,
-// EXISTS COMMAND DEFINED
+// IS_DIRECTORY EXISTS COMMAND DEFINED
// MATCHES LESS GREATER EQUAL STRLESS STRGREATER STREQUAL
// AND OR
//
// There is an issue on whether the arguments should be values of references,
// for example IF (FOO AND BAR) should that compare the strings FOO and BAR
-// or should it really do IF (${FOO} AND ${BAR}) Currently EXISTS COMMAND and
-// DEFINED all take values. EQUAL, LESS and GREATER can take numeric values or
-// variable names. STRLESS and STRGREATER take variable names but if the
-// variable name is not found it will use the name directly. AND OR take
-// variables or the values 0 or 1.
+// or should it really do IF (${FOO} AND ${BAR}) Currently IS_DIRECTORY
+// EXISTS COMMAND and DEFINED all take values. EQUAL, LESS and GREATER can
+// take numeric values or variable names. STRLESS and STRGREATER take
+// variable names but if the variable name is not found it will use the name
+// directly. AND OR take variables or the values 0 or 1.
bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
@@ -243,6 +243,22 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
IncrementArguments(newArgs,argP1,argP2);
reducible = 1;
}
+ // does a file exist
+ if (*arg == "IS_DIRECTORY" && argP1 != newArgs.end())
+ {
+ if(cmSystemTools::FileIsDirectory((argP1)->c_str()))
+ {
+ *arg = "1";
+ }
+ else
+ {
+ *arg = "0";
+ }
+ newArgs.erase(argP1);
+ argP1 = arg;
+ IncrementArguments(newArgs,argP1,argP2);
+ reducible = 1;
+ }
// does a command exist
if (*arg == "COMMAND" && argP1 != newArgs.end())
{