-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
225 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,10 @@ | |
|
||
# ENSURE_VERSION | ||
# This macro compares version numbers of the form "x.y.z" or "x.y" | ||
# ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK) | ||
# ENSURE_VERSION(FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK) | ||
# will set FOO_VERSION_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION | ||
# Leading and trailing text is ok, e.g. | ||
# ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK) | ||
# ENSURE_VERSION("2.5.31" "flex 2.5.4a" VERSION_OK) | ||
# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system | ||
|
||
# Copyright (c) 2006, David Faure, <[email protected]> | ||
|
@@ -29,7 +29,7 @@ | |
# min_version <= found_version < max_version. | ||
# If this expression holds, FOO_VERSION_OK will be set TRUE | ||
# | ||
# Example: ENSURE_VERSION_RANGE3( "0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK ) | ||
# Example: ENSURE_VERSION_RANGE3("0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK) | ||
# | ||
# This macro will break silently if any of x,y,z are greater than 100. | ||
# | ||
|
@@ -61,55 +61,55 @@ | |
|
||
MACRO(NORMALIZE_VERSION _requested_version _normalized_version) | ||
STRING(REGEX MATCH "[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+.*" _threePartMatch "${_requested_version}") | ||
if (_threePartMatch) | ||
if(_threePartMatch) | ||
# parse the parts of the version string | ||
STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major_vers "${_requested_version}") | ||
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" _minor_vers "${_requested_version}") | ||
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" _patch_vers "${_requested_version}") | ||
else (_threePartMatch) | ||
else(_threePartMatch) | ||
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+" "\\1" _major_vers "${_requested_version}") | ||
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)" "\\1" _minor_vers "${_requested_version}") | ||
set(_patch_vers "0") | ||
endif (_threePartMatch) | ||
endif(_threePartMatch) | ||
|
||
# compute an overall version number which can be compared at once | ||
MATH(EXPR ${_normalized_version} "${_major_vers}*10000 + ${_minor_vers}*100 + ${_patch_vers}") | ||
ENDMACRO(NORMALIZE_VERSION) | ||
|
||
MACRO(CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok) | ||
if (${_value} LESS ${_lower_limit}) | ||
set( ${_ok} FALSE ) | ||
elseif (${_value} EQUAL ${_lower_limit}) | ||
set( ${_ok} TRUE ) | ||
elseif (${_value} EQUAL ${_upper_limit}) | ||
set( ${_ok} FALSE ) | ||
elseif (${_value} GREATER ${_upper_limit}) | ||
set( ${_ok} FALSE ) | ||
else (${_value} LESS ${_lower_limit}) | ||
set( ${_ok} TRUE ) | ||
endif (${_value} LESS ${_lower_limit}) | ||
if(${_value} LESS ${_lower_limit}) | ||
set(${_ok} FALSE) | ||
elseif(${_value} EQUAL ${_lower_limit}) | ||
set(${_ok} TRUE) | ||
elseif(${_value} EQUAL ${_upper_limit}) | ||
set(${_ok} FALSE) | ||
elseif(${_value} GREATER ${_upper_limit}) | ||
set(${_ok} FALSE) | ||
else(${_value} LESS ${_lower_limit}) | ||
set(${_ok} TRUE) | ||
endif(${_value} LESS ${_lower_limit}) | ||
ENDMACRO(CHECK_RANGE_INCLUSIVE_LOWER) | ||
|
||
MACRO(ENSURE_VERSION requested_version found_version var_too_old) | ||
NORMALIZE_VERSION( ${requested_version} req_vers_num ) | ||
NORMALIZE_VERSION( ${found_version} found_vers_num ) | ||
NORMALIZE_VERSION(${requested_version} req_vers_num) | ||
NORMALIZE_VERSION(${found_version} found_vers_num) | ||
|
||
if (found_vers_num LESS req_vers_num) | ||
set( ${var_too_old} FALSE ) | ||
else (found_vers_num LESS req_vers_num) | ||
set( ${var_too_old} TRUE ) | ||
endif (found_vers_num LESS req_vers_num) | ||
if(found_vers_num LESS req_vers_num) | ||
set(${var_too_old} FALSE) | ||
else(found_vers_num LESS req_vers_num) | ||
set(${var_too_old} TRUE) | ||
endif(found_vers_num LESS req_vers_num) | ||
|
||
ENDMACRO(ENSURE_VERSION) | ||
|
||
MACRO(ENSURE_VERSION2 requested_version2 found_version2 var_too_old2) | ||
ENSURE_VERSION( ${requested_version2} ${found_version2} ${var_too_old2}) | ||
ENSURE_VERSION(${requested_version2} ${found_version2} ${var_too_old2}) | ||
ENDMACRO(ENSURE_VERSION2) | ||
|
||
MACRO(ENSURE_VERSION_RANGE min_version found_version max_version var_ok) | ||
NORMALIZE_VERSION( ${min_version} req_vers_num ) | ||
NORMALIZE_VERSION( ${found_version} found_vers_num ) | ||
NORMALIZE_VERSION( ${max_version} max_vers_num ) | ||
NORMALIZE_VERSION(${min_version} req_vers_num) | ||
NORMALIZE_VERSION(${found_version} found_vers_num) | ||
NORMALIZE_VERSION(${max_version} max_vers_num) | ||
|
||
CHECK_RANGE_INCLUSIVE_LOWER( ${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok}) | ||
CHECK_RANGE_INCLUSIVE_LOWER(${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok}) | ||
ENDMACRO(ENSURE_VERSION_RANGE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.