added exists option for if statement
This commit is contained in:
parent
b4e27e9795
commit
e07ea14e31
|
@ -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"))
|
if (args.size() == 2 && (args[0] == "NOT"))
|
||||||
{
|
{
|
||||||
def = m_Makefile->GetDefinition(args[1].c_str());
|
def = m_Makefile->GetDefinition(args[1].c_str());
|
||||||
|
|
|
@ -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"))
|
if (args.size() == 3 && (args[1] == "AND"))
|
||||||
{
|
{
|
||||||
def = m_Makefile->GetDefinition(args[0].c_str());
|
def = m_Makefile->GetDefinition(args[0].c_str());
|
||||||
|
|
|
@ -115,7 +115,9 @@ public:
|
||||||
return
|
return
|
||||||
"IF (define) Starts an if block. Optionally it can be invoked "
|
"IF (define) Starts an if block. Optionally it can be invoked "
|
||||||
"using (NOT define) (def AND def2) (def OR def2) (def MATCHES def2) "
|
"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);
|
cmTypeMacro(cmIfCommand, cmCommand);
|
||||||
|
|
Loading…
Reference in New Issue