From 0f8cf66387c803146ba6f59019b9995566b1ddcc Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 15 Dec 2023 19:46:04 -0500 Subject: [PATCH] Expose zlib constants for backwards compat #747 Building a project that had an internal copy of minizip 1.x, but preferring an external library, with minizip 4.x showed that the compat layer was not exposing some constants from zlib that minizip 1.x headers did. --- CMakeLists.txt | 4 +++- mz_compat.h | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da2456a0..92c841da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -711,7 +711,9 @@ 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/mz_compat.h b/mz_compat.h index 47153ea2..cc1fa07c 100644 --- a/mz_compat.h +++ b/mz_compat.h @@ -15,6 +15,10 @@ #include "mz.h" +#ifndef ZLIB_H +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -147,9 +151,6 @@ typedef const char *zipcharpc; #define ZIP_BADZIPFILE (-103) #define ZIP_INTERNALERROR (-104) -#ifndef Z_DEFLATED -#define Z_DEFLATED (8) -#endif #define Z_BZIP2ED (12) #define APPEND_STATUS_CREATE (0)