mirror of
https://github.com/opencv/opencv.git
synced 2026-09-11 04:43:22 -05:00
Fix zlib version parse
Currently cmake scripttry to use regex to parse VER_MAJOR, VER_MINOR, VER_REVISION from ZLIB_VERSION. However, ZLIB_VERSION is "1.3" which means that there is no VER_REVISION. You can reproduce using "-DBUILD_ZLIB=ON" ``` -- ZLib: zlib (ver 1.3.#define ZLIB_VERSION "1.3") ``` This patch add a new macro ocv_parse_header_version to extract version information.
This commit is contained in:
@@ -1430,6 +1430,18 @@ macro(ocv_parse_header2 LIBNAME HDR_PATH VARNAME)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# set ${LIBNAME}_VERSION_STRING to ${LIBNAME}_VERSION without quotes
|
||||
macro(ocv_parse_header_version LIBNAME HDR_PATH)
|
||||
ocv_clear_vars(${LIBNAME}_VERSION_STRING)
|
||||
set(${LIBNAME}_H "")
|
||||
if(EXISTS "${HDR_PATH}")
|
||||
file(STRINGS "${HDR_PATH}" ${LIBNAME}_H REGEX "^#define[ \t]+${LIBNAME}_VERSION[ \t]+\"[^\"]*\".*$" LIMIT_COUNT 1)
|
||||
endif()
|
||||
if(${LIBNAME}_H)
|
||||
string(REGEX REPLACE "^.*[ \t]${LIBNAME}_VERSION[ \t]+\"([0-9\.]+)\"$" "\\1" ${LIBNAME}_VERSION_STRING "${${LIBNAME}_H}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
################################################################################################
|
||||
# short command to setup source group
|
||||
function(ocv_source_group group)
|
||||
|
||||
Reference in New Issue
Block a user