summaryrefslogtreecommitdiffstats
path: root/Source/cmIfCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-09-11 19:52:21 (GMT)
committerBrad King <brad.king@kitware.com>2012-09-11 19:59:16 (GMT)
commitdfa0ebd646203e4cecc150ff7589392d899e13d4 (patch)
treeeb1505641a294daaadeb41ce963079b86d7ba61d /Source/cmIfCommand.cxx
parent1d3db6b34df827566ffe5615d568de0ef64d3e61 (diff)
downloadCMake-dfa0ebd646203e4cecc150ff7589392d899e13d4.zip
CMake-dfa0ebd646203e4cecc150ff7589392d899e13d4.tar.gz
CMake-dfa0ebd646203e4cecc150ff7589392d899e13d4.tar.bz2
if: Compare up to 8 components in VERSION tests
Extend the number of components tested by if(... VERSION_LESS ...) if(... VERSION_EQUAL ...) if(... VERSION_GREATER ...) from 4 to 8. The latter is a more extreme maximum.
Diffstat (limited to 'Source/cmIfCommand.cxx')
-rw-r--r--Source/cmIfCommand.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index ffc0f35..56d7170 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -409,14 +409,18 @@ namespace
enum Op { OpLess, OpEqual, OpGreater };
bool HandleVersionCompare(Op op, const char* lhs_str, const char* rhs_str)
{
- // Parse out up to 4 components.
- unsigned int lhs[4] = {0,0,0,0};
- unsigned int rhs[4] = {0,0,0,0};
- sscanf(lhs_str, "%u.%u.%u.%u", &lhs[0], &lhs[1], &lhs[2], &lhs[3]);
- sscanf(rhs_str, "%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(lhs_str, "%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(rhs_str, "%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])
{