ENH: add a numeric EQUAL to the IF statment, very useful for variable arguments in MACROS
This commit is contained in:
parent
b2bddc9f0d
commit
d76c9f8195
@ -259,6 +259,17 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
|
|||||||
isValid = true;
|
isValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.size() == 3 && (args[1] == "EQUAL"))
|
||||||
|
{
|
||||||
|
def = cmIfCommand::GetVariableOrString(args[0].c_str(), makefile);
|
||||||
|
def2 = cmIfCommand::GetVariableOrString(args[2].c_str(), makefile);
|
||||||
|
if(atof(def) == atof(def2))
|
||||||
|
{
|
||||||
|
isTrue = false;
|
||||||
|
}
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.size() == 3 && (args[1] == "STRLESS"))
|
if (args.size() == 3 && (args[1] == "STRLESS"))
|
||||||
{
|
{
|
||||||
def = cmIfCommand::GetVariableOrString(args[0].c_str(), makefile);
|
def = cmIfCommand::GetVariableOrString(args[0].c_str(), makefile);
|
||||||
|
@ -137,8 +137,10 @@ public:
|
|||||||
" IF(string LESS number)\n"
|
" IF(string LESS number)\n"
|
||||||
" IF(variable GREATER number)\n"
|
" IF(variable GREATER number)\n"
|
||||||
" IF(string GREATER number)\n"
|
" IF(string GREATER number)\n"
|
||||||
|
" IF(variable EQUAL number)\n"
|
||||||
|
" IF(string EQUAL number)\n"
|
||||||
"True if the given string or variable's value is a valid number and "
|
"True if the given string or variable's value is a valid number and "
|
||||||
"the inequality is true.\n"
|
"the inequality or equality is true.\n"
|
||||||
" IF(variable STRLESS string)\n"
|
" IF(variable STRLESS string)\n"
|
||||||
" IF(string STRLESS string)\n"
|
" IF(string STRLESS string)\n"
|
||||||
" IF(variable STRGREATER string)\n"
|
" IF(variable STRGREATER string)\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user