diff options
author | Brad King <brad.king@kitware.com> | 2013-06-26 13:02:49 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-06-26 13:02:49 (GMT) |
commit | c1631efa0eb0b33680ea73f745379eebf4d573a8 (patch) | |
tree | c1ba7e9d8d3d638c3ea3540cdbea891c08a63853 /Source/cmSystemTools.cxx | |
parent | 22fbeaa14b5d79bc065b1c3061359c886167cc01 (diff) | |
parent | e6055284b347775ae1396725704778af0bfb56c7 (diff) | |
download | CMake-c1631efa0eb0b33680ea73f745379eebf4d573a8.zip CMake-c1631efa0eb0b33680ea73f745379eebf4d573a8.tar.gz CMake-c1631efa0eb0b33680ea73f745379eebf4d573a8.tar.bz2 |
Merge topic 'version-compare-genex'
e605528 Add generator expressions for version comparision.
48bb48e De-duplicate version comparison code.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d294104..4ae16cc 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2683,13 +2683,18 @@ 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]); + // Parse out up to 8 components. + unsigned int lhs[8] = {0,0,0,0,0,0,0,0}; + unsigned int rhs[8] = {0,0,0,0,0,0,0,0}; + sscanf(lhss, "%u.%u.%u.%u.%u.%u.%u.%u", + &lhs[0], &lhs[1], &lhs[2], &lhs[3], + &lhs[4], &lhs[5], &lhs[6], &lhs[7]); + sscanf(rhss, "%u.%u.%u.%u.%u.%u.%u.%u", + &rhs[0], &rhs[1], &rhs[2], &rhs[3], + &rhs[4], &rhs[5], &rhs[6], &rhs[7]); // Do component-wise comparison. - for(unsigned int i=0; i < 4; ++i) + for(unsigned int i=0; i < 8; ++i) { if(lhs[i] < rhs[i]) { |