diff options
author | Chuck Atkins <chuck.atkins@kitware.com> | 2016-08-05 18:11:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-08-09 13:30:34 (GMT) |
commit | 02d177c9cc05514baccfa530ab85eec65374fbcb (patch) | |
tree | 2fbef7a16d4acac2b3b7218ef1abd16690566d9a /Source/cmStringCommand.cxx | |
parent | 93b705a396c23f771ba203efb6f2f4934ae027b7 (diff) | |
download | CMake-02d177c9cc05514baccfa530ab85eec65374fbcb.zip CMake-02d177c9cc05514baccfa530ab85eec65374fbcb.tar.gz CMake-02d177c9cc05514baccfa530ab85eec65374fbcb.tar.bz2 |
Add additional <= and >= comparison operators
This adds the LESS_EQUAL, GREATER_EQUAL, and associated STR and VERSION
equivalents to use the combined <= and >= functionality.
Diffstat (limited to 'Source/cmStringCommand.cxx')
-rw-r--r-- | Source/cmStringCommand.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index dce4687..3c913ee 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -485,7 +485,8 @@ bool cmStringCommand::HandleCompareCommand( } std::string mode = args[1]; if ((mode == "EQUAL") || (mode == "NOTEQUAL") || (mode == "LESS") || - (mode == "GREATER")) { + (mode == "LESS_EQUAL") || (mode == "GREATER") || + (mode == "GREATER_EQUAL")) { if (args.size() < 5) { std::string e = "sub-command COMPARE, mode "; e += mode; @@ -500,8 +501,12 @@ bool cmStringCommand::HandleCompareCommand( bool result; if (mode == "LESS") { result = (left < right); + } else if (mode == "LESS_EQUAL") { + result = (left <= right); } else if (mode == "GREATER") { result = (left > right); + } else if (mode == "GREATER_EQUAL") { + result = (left >= right); } else if (mode == "EQUAL") { result = (left == right); } else // if(mode == "NOTEQUAL") |