Skip to content

Not fetching but pointing at ZLIB-NG installation does not work #903

@emrecanbulut

Description

@emrecanbulut

Hi,

I am on Windows x64 with MSVC compiler trying to make a static minizip-ng library. The issue is, I want to point at a specific version of zlib-ng which I have readily available on my machine.

This is how I try to build and install it:

cmake -S . -B %BUILD_DIR% ^
  -DBUILD_SHARED_LIBS=OFF ^
  -DMZ_SANITIZER=OFF ^
  -DMZ_FETCH_LIBS=OFF ^
  -DMZ_ZLIB=ON ^
  -DMZ_ZLIB_FLAVOR="zlib-ng" ^
  -DMZ_BZIP2=OFF ^
  -DMZ_LZMA=OFF ^
  -DMZ_ZSTD=OFF ^
  -DMZ_PKCRYPT=ON ^
  -DMZ_WZAES=ON ^
  -DMZ_OPENSSL=OFF ^
  -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ^
  -DCMAKE_PREFIX_PATH=%ZLIB_NG_ROOT%

cmake --build %BUILD_DIR% --config Release --target INSTALL

Because it cannot find ZLIB, it will then disable the compression:
Image

I believe the issue lies here at FindZLIB-NG.cmake:

diff --git a/cmake/FindZLIB-NG.cmake b/cmake/FindZLIB-NG.cmake
index fd5d924..b8ba6bb 100644
--- a/cmake/FindZLIB-NG.cmake
+++ b/cmake/FindZLIB-NG.cmake
@@ -1,6 +1,6 @@
 find_path(ZLIB-NG_INCLUDE_DIRS NAMES zlib-ng.h)

-if(ZLIB_INCLUDE_DIRS)
+if(ZLIB-NG_INCLUDE_DIRS)
     set(ZLIB-NG_LIBRARY_DIRS ${ZLIB-NG_INCLUDE_DIRS})

     if("${ZLIB-NG_LIBRARY_DIRS}" MATCHES "/include$")
@@ -13,7 +13,7 @@ if(ZLIB_INCLUDE_DIRS)
     endif()
 endif()

-find_library(ZLIB-NG_LIBRARY NAMES z-ng libz-ng libz-ng.a)
+find_library(ZLIB-NG_LIBRARY NAMES z-ng libz-ng libz-ng.a zlib-ng zlibstatic-ng)

 set(ZLIB-NG_LIBRARIES ${ZLIB-NG_LIBRARY})
 set(ZLIB-NG_INCLUDE_DIRS ${ZLIB-NG_INCLUDE_DIRS})

With the changes above:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions