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:
Letu Ren
2023-12-22 11:39:57 +08:00
parent 8fc31ee9df
commit 3a600db4ab
2 changed files with 13 additions and 1 deletions

View File

@@ -34,7 +34,7 @@ if(NOT ZLIB_FOUND)
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
ocv_parse_header2(ZLIB "${${ZLIB_LIBRARY}_SOURCE_DIR}/zlib.h" ZLIB_VERSION)
ocv_parse_header_version(ZLIB "${${ZLIB_LIBRARY}_SOURCE_DIR}/zlib.h")
endif()
# --- libavif (optional) ---