diff --git a/CMakeLists.txt b/CMakeLists.txt index d27a4b24..dc775c46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -701,9 +701,7 @@ target_include_directories(${MINIZIP_TARGET} PUBLIC if(MZ_COMPAT) target_include_directories(${MINIZIP_TARGET} PUBLIC $ - $ - ${ZLIB_SOURCE_DIR} - ${ZLIB_BINARY_DIR}) + $) endif() # Install files diff --git a/compat/crypt.h b/compat/crypt.h index 6e9b51ff..516013dd 100644 --- a/compat/crypt.h +++ b/compat/crypt.h @@ -26,7 +26,10 @@ */ #ifndef _ZLIB_H -# if (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270) +# ifndef ZLIB_VERNUM + /* HAVE_ZLIB but no ZLIB_VERNUM? */ + typedef uint32_t z_crc_t; +# elif (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270) /* Define z_crc_t in zlib 1.2.6 and less */ typedef unsigned long z_crc_t; # elif (ZLIB_VERNUM & 0xf == 0xf) && (ZLIB_VERNUM < 0x12df) diff --git a/compat/ioapi.h b/compat/ioapi.h index d1d5b094..88bf2c4b 100644 --- a/compat/ioapi.h +++ b/compat/ioapi.h @@ -5,7 +5,11 @@ #include #ifndef _ZLIB_H -#include "zlib.h" +# if __has_include() +# include +# elif __has_include() +# include +# endif #endif typedef uint64_t ZPOS64_T; diff --git a/mz_crypt.c b/mz_crypt.c index 2971f84c..f4a6c3ee 100644 --- a/mz_crypt.c +++ b/mz_crypt.c @@ -34,7 +34,10 @@ int32_t mz_crypt_rand(uint8_t *buf, int32_t size) { uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size) { #if defined(HAVE_ZLIB) -# if (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270) +# ifndef ZLIB_VERNUM + /* HAVE_ZLIB but no ZLIB_VERNUM? */ + typedef uint32_t z_crc_t; +# elif (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270) /* Define z_crc_t in zlib 1.2.6 and less */ typedef unsigned long z_crc_t; # elif (ZLIB_VERNUM & 0xf == 0xf) && (ZLIB_VERNUM < 0x12df)