summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index f5fba5c..89a241d 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2691,6 +2691,33 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
}
//----------------------------------------------------------------------------
+bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
+ const char* lhss, const char* rhss)
+{
+ unsigned int lhs[4] = {0,0,0,0};
+ unsigned int rhs[4] = {0,0,0,0};
+ sscanf(lhss, "%u.%u.%u.%u", &lhs[0], &lhs[1], &lhs[2], &lhs[3]);
+ sscanf(rhss, "%u.%u.%u.%u", &rhs[0], &rhs[1], &rhs[2], &rhs[3]);
+
+ // Do component-wise comparison.
+ for(unsigned int i=0; i < 4; ++i)
+ {
+ if(lhs[i] < rhs[i])
+ {
+ // lhs < rhs, so true if operation is LESS
+ return op == cmSystemTools::OP_LESS;
+ }
+ else if(lhs[i] > rhs[i])
+ {
+ // lhs > rhs, so true if operation is GREATER
+ return op == cmSystemTools::OP_GREATER;
+ }
+ }
+ // lhs == rhs, so true if operation is EQUAL
+ return op == cmSystemTools::OP_EQUAL;
+}
+
+//----------------------------------------------------------------------------
bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
bool* removed)
{