Skip to content

Commit 1176a22

Browse files
committed
Fix transitive finding of zlib-ng
1 parent 57cc292 commit 1176a22

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,17 @@ endif()
173173
if(MZ_ZLIB)
174174
# Check if zlib is present
175175
if(NOT MZ_FORCE_FETCH_LIBS)
176-
find_package(ZLIBNG QUIET)
176+
find_package(ZLIB-NG QUIET)
177177
find_package(ZLIB QUIET)
178178
set(ZLIB_VERSION ${ZLIB_VERSION_STRING})
179179
endif()
180180

181-
if(ZLIBNG_FOUND AND NOT MZ_FORCE_FETCH_LIBS)
182-
message(STATUS "Using ZLIBNG")
181+
if(ZLIB-NG_FOUND AND NOT MZ_FORCE_FETCH_LIBS)
182+
message(STATUS "Using ZLIB-NG")
183183

184-
list(APPEND MINIZIP_INC ${ZLIBNG_INCLUDE_DIRS})
185-
list(APPEND MINIZIP_LIB ${ZLIBNG_LIBRARIES})
186-
list(APPEND MINIZIP_LBD ${ZLIBNG_LIBRARY_DIRS})
184+
list(APPEND MINIZIP_INC ${ZLIB-NG_INCLUDE_DIRS})
185+
list(APPEND MINIZIP_LIB ${ZLIB-NG_LIBRARIES})
186+
list(APPEND MINIZIP_LBD ${ZLIB-NG_LIBRARY_DIRS})
187187

188188
set(PC_PRIVATE_DEPS "zlib-ng")
189189
set(ZLIB_COMPAT OFF)
@@ -215,7 +215,7 @@ if(MZ_ZLIB)
215215
endif()
216216

217217
if(EXISTS "${ZLIB_BINARY_DIR}/zlib-ng.h")
218-
message(STATUS "ZLIB repository detected as ZLIBNG")
218+
message(STATUS "ZLIB repository detected as ZLIB-NG")
219219
set(ZLIB_COMPAT OFF)
220220
else()
221221
set(ZLIB_COMPAT ON)
@@ -231,8 +231,8 @@ if(MZ_ZLIB)
231231
if(ZLIB_COMPAT)
232232
list(APPEND MINIZIP_DEF -DZLIB_COMPAT)
233233
endif()
234-
if(ZLIBNG_FOUND OR NOT ZLIB_COMPAT)
235-
list(APPEND MINIZIP_DEP_PKG ZLIBNG)
234+
if(ZLIB-NG_FOUND OR NOT ZLIB_COMPAT)
235+
list(APPEND MINIZIP_DEP_PKG ZLIB-NG)
236236
elseif(ZLIB_FOUND)
237237
list(APPEND MINIZIP_DEP_PKG ZLIB)
238238
endif()

cmake/FindZLIB-NG.cmake

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
find_path(ZLIB-NG_INCLUDE_DIRS NAMES zlib-ng.h)
2+
3+
if(ZLIB_INCLUDE_DIRS)
4+
set(ZLIB-NG_LIBRARY_DIRS ${ZLIB-NG_INCLUDE_DIRS})
5+
6+
if("${ZLIB-NG_LIBRARY_DIRS}" MATCHES "/include$")
7+
# Strip off the trailing "/include" in the path.
8+
get_filename_component(ZLIB-NG_LIBRARY_DIRS ${ZLIB-NG_LIBRARY_DIRS} PATH)
9+
endif()
10+
11+
if(EXISTS "${ZLIB-NG_LIBRARY_DIRS}/lib")
12+
set(ZLIB-NG_LIBRARY_DIRS ${ZLIB-NG_LIBRARY_DIRS}/lib)
13+
endif()
14+
endif()
15+
16+
find_library(ZLIB-NG_LIBRARY NAMES z-ng libz-ng libz-ng.a)
17+
18+
set(ZLIB-NG_LIBRARIES ${ZLIB-NG_LIBRARY})
19+
set(ZLIB-NG_INCLUDE_DIRS ${ZLIB-NG_INCLUDE_DIRS})
20+
21+
include(FindPackageHandleStandardArgs)
22+
find_package_handle_standard_args(ZLIB-NG DEFAULT_MSG ZLIB-NG_LIBRARY ZLIB-NG_INCLUDE_DIRS)
23+
24+
if(ZLIB-NG_INCLUDE_DIRS AND ZLIB-NG_LIBRARIES)
25+
set(ZLIB-NG_FOUND ON)
26+
else(ZLIB-NG_INCLUDE_DIRS AND ZLIB-NG_LIBRARIES)
27+
set(ZLIB-NG_FOUND OFF)
28+
endif()
29+
30+
if(ZLIB-NG_FOUND)
31+
message(STATUS "Found zlib-ng: ${ZLIB-NG_LIBRARIES}, ${ZLIB-NG_INCLUDE_DIRS}")
32+
endif()

cmake/FindZLIBNG.cmake

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)