cmake: don't check ZLIB_COMPAT before it is set in MZ_FETCH_LIBS

This commit is contained in:
Nathan Moin Vaziri 2026-04-24 22:17:41 -07:00
parent 597ee06152
commit 322c161a2f

View file

@ -226,19 +226,19 @@ if(MZ_ZLIB)
list(APPEND MINIZIP_INC ${ZLIB_SOURCE_DIR})
list(APPEND MINIZIP_INC ${ZLIB_BINARY_DIR})
# Have to add zlib to install targets
if(ZLIB_COMPAT AND (NOT DEFINED BUILD_SHARED_LIBS OR NOT BUILD_SHARED_LIBS))
list(APPEND MINIZIP_DEP zlibstatic)
else()
list(APPEND MINIZIP_DEP zlib)
endif()
if(EXISTS "${ZLIB_BINARY_DIR}/zlib-ng.h")
message(STATUS "ZLIB repository detected as ZLIB-NG")
set(ZLIB_COMPAT OFF)
else()
set(ZLIB_COMPAT ON)
endif()
# Have to add zlib to install targets
if(ZLIB_COMPAT AND (NOT DEFINED BUILD_SHARED_LIBS OR NOT BUILD_SHARED_LIBS))
list(APPEND MINIZIP_DEP zlibstatic)
else()
list(APPEND MINIZIP_DEP zlib)
endif()
else()
message(STATUS "ZLIB library not found")