diff options
author | Ken Martin <ken.martin@kitware.com> | 2004-06-14 16:02:12 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2004-06-14 16:02:12 (GMT) |
commit | a18fbc3b37e9ee8648fd701c5eb76bc467a4478a (patch) | |
tree | e2ca2b593cd10e2edd08319f3b6a1bec61b0cb2a /Source/cmIfCommand.cxx | |
parent | cd875fe7816fdfb71c5970754f54f927a8c68321 (diff) | |
download | CMake-a18fbc3b37e9ee8648fd701c5eb76bc467a4478a.zip CMake-a18fbc3b37e9ee8648fd701c5eb76bc467a4478a.tar.gz CMake-a18fbc3b37e9ee8648fd701c5eb76bc467a4478a.tar.bz2 |
added strequal
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r-- | Source/cmIfCommand.cxx | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index a2ffd21..d9d4446 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -133,7 +133,7 @@ bool cmIfCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args) // order of operations, // EXISTS COMMAND DEFINED -// MATCHES LESS GREATER EQUAL STRLESS STRGREATER +// MATCHES LESS GREATER EQUAL STRLESS STRGREATER STREQUAL // AND OR // // There is an issue on whether the arguments should be values of references, @@ -357,32 +357,34 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args, } if (argP1 != newArgs.end() && argP2 != newArgs.end() && - (*(argP1) == "STRLESS" || *(argP1) == "STRGREATER")) + (*(argP1) == "STRLESS" || + *(argP1) == "STREQUAL" || + *(argP1) == "STRGREATER")) { def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); + int val = strcmp(def,def2); + int result; if (*(argP1) == "STRLESS") { - if(strcmp(def,def2) < 0) - { - *arg = "1"; - } - else - { - *arg = "0"; - } + result = (val < 0); + } + else if (*(argP1) == "STRGREATER") + { + result = (val > 0); + } + else // strequal + { + result = (val == 0); + } + if(result) + { + *arg = "1"; } else { - if(strcmp(def,def2) > 0) - { - *arg = "1"; - } - else - { - *arg = "0"; - } - } + *arg = "0"; + } newArgs.erase(argP2); newArgs.erase(argP1); argP1 = arg; |