From d76c9f8195b5f98f5fd2a99c88094192b9719288 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 28 Apr 2004 09:51:06 -0400 Subject: ENH: add a numeric EQUAL to the IF statment, very useful for variable arguments in MACROS --- Source/cmIfCommand.cxx | 11 +++++++++++ Source/cmIfCommand.h | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index cf925df..830e1ba 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -259,6 +259,17 @@ bool cmIfCommand::IsTrue(const std::vector &args, 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")) { def = cmIfCommand::GetVariableOrString(args[0].c_str(), makefile); diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 05faac5..3dc72b9 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -137,8 +137,10 @@ public: " IF(string LESS number)\n" " IF(variable 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 " - "the inequality is true.\n" + "the inequality or equality is true.\n" " IF(variable STRLESS string)\n" " IF(string STRLESS string)\n" " IF(variable STRGREATER string)\n" -- cgit v0.12