summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2002-01-02 21:46:08 (GMT)
committerKen Martin <ken.martin@kitware.com>2002-01-02 21:46:08 (GMT)
commite07ea14e31e1d91632bdd5d56124ab394042f0d1 (patch)
treed5628ce0b9dd99aacdc708f59f92d0893f79e57d /Source
parentb4e27e979556e89dc6bb6c8517cc71d20a717c69 (diff)
downloadCMake-e07ea14e31e1d91632bdd5d56124ab394042f0d1.zip
CMake-e07ea14e31e1d91632bdd5d56124ab394042f0d1.tar.gz
CMake-e07ea14e31e1d91632bdd5d56124ab394042f0d1.tar.bz2
added exists option for if statement
Diffstat (limited to 'Source')
-rw-r--r--Source/cmElseCommand.cxx8
-rw-r--r--Source/cmIfCommand.cxx8
-rw-r--r--Source/cmIfCommand.h4
3 files changed, 19 insertions, 1 deletions
diff --git a/Source/cmElseCommand.cxx b/Source/cmElseCommand.cxx
index 7daca42..c04dbeb 100644
--- a/Source/cmElseCommand.cxx
+++ b/Source/cmElseCommand.cxx
@@ -73,6 +73,14 @@ bool cmElseCommand::InitialPass(std::vector<std::string> const& args)
}
}
+ if (args.size() == 2 && (args[0] == "EXISTS"))
+ {
+ if(cmSystemTools::FileExists(args[1].c_str()))
+ {
+ f = new cmIfFunctionBlocker();
+ }
+ }
+
if (args.size() == 2 && (args[0] == "NOT"))
{
def = m_Makefile->GetDefinition(args[1].c_str());
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index f549e5c..83da56f 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -134,6 +134,14 @@ bool cmIfCommand::InitialPass(std::vector<std::string> const& args)
}
}
+ if (args.size() == 2 && (args[0] == "EXISTS"))
+ {
+ if(!cmSystemTools::FileExists(args[1].c_str()))
+ {
+ f = new cmIfFunctionBlocker();
+ }
+ }
+
if (args.size() == 3 && (args[1] == "AND"))
{
def = m_Makefile->GetDefinition(args[0].c_str());
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index 9d8910f..d663253 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -115,7 +115,9 @@ public:
return
"IF (define) Starts an if block. Optionally it can be invoked "
"using (NOT define) (def AND def2) (def OR def2) (def MATCHES def2) "
- "MATCHES checks if def matches the regular expression def2 ";
+ "(COMMAND cmd) (EXISTS file) MATCHES checks if def matches the "
+ "regular expression def2. COMMAND checks if the cmake command cmd "
+ "is in this cmake executable. EXISTS file checks if file exists";
}
cmTypeMacro(cmIfCommand, cmCommand);