From: Letu Ren Date: Sun, 17 Dec 2023 16:58:38 +0000 (+0800) Subject: Only read version information from zlib.h.in X-Git-Tag: 2.1.6~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6127381acc568de1b1f7a3e33290be2a82fa7f5;p=thirdparty%2Fzlib-ng.git Only read version information from zlib.h.in This is a patch for https://github.com/zlib-ng/zlib-ng/commit/cd458c79c7923e76ffdd0e2638bf2a0eed4f3996 As the commit message says: "Add code to extract version information for both ZLIB and ZLIBNG variants from the zlib.h file." The logic of ${SUFFIX} is that zlib-ng reads version information after parse ZLIB_COMPAT before the commit mentioned above. ${SUFFIX} will only be set by ZLIB_COMPAT and is meaningless before ZLIB_COMPAT. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f5b6cf5..9170ed58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,8 +23,8 @@ if(NOT CMAKE_C_STANDARD IN_LIST VALID_C_STANDARDS) MESSAGE(FATAL_ERROR "CMAKE_C_STANDARD:STRING=${CMAKE_C_STANDARD} not in known standards list\n ${VALID_C_STANDARDS}") endif() -# Parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.h.in _zlib_h_contents) +# Parse the full version number from zlib.h.in and include in ZLIB_FULL_VERSION +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h.in _zlib_h_contents) string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9]+.[0-9]+.[0-9]+).*\".*" "\\1" ZLIB_HEADER_VERSION ${_zlib_h_contents}) string(REGEX REPLACE ".*#define[ \t]+ZLIBNG_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"