summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2016-08-05 18:11:46 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-09 13:30:34 (GMT)
commit02d177c9cc05514baccfa530ab85eec65374fbcb (patch)
tree2fbef7a16d4acac2b3b7218ef1abd16690566d9a /Source/cmSystemTools.cxx
parent93b705a396c23f771ba203efb6f2f4934ae027b7 (diff)
downloadCMake-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/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 9740ef7..5745a01 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2380,10 +2380,10 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
if (lhs < rhs) {
// lhs < rhs, so true if operation is LESS
- return op == cmSystemTools::OP_LESS;
+ return (op & cmSystemTools::OP_LESS) != 0;
} else if (lhs > rhs) {
// lhs > rhs, so true if operation is GREATER
- return op == cmSystemTools::OP_GREATER;
+ return (op & cmSystemTools::OP_GREATER) != 0;
}
if (*endr == '.') {
@@ -2395,7 +2395,7 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
}
}
// lhs == rhs, so true if operation is EQUAL
- return op == cmSystemTools::OP_EQUAL;
+ return (op & cmSystemTools::OP_EQUAL) != 0;
}
bool cmSystemTools::VersionCompareEqual(std::string const& lhs,
@@ -2412,6 +2412,13 @@ bool cmSystemTools::VersionCompareGreater(std::string const& lhs,
rhs.c_str());
}
+bool cmSystemTools::VersionCompareGreaterEq(std::string const& lhs,
+ std::string const& rhs)
+{
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL,
+ lhs.c_str(), rhs.c_str());
+}
+
bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
bool* removed)
{