List Archive


Thread Index


From: Thomas Klausner <>
To: Andreas Falkenhahn <>
Subject: Re: Setting zlib path when compiling on Windows
Date: Mon, 2 Oct 2017 23:27:59 +0200

On Mon, Oct 02, 2017 at 10:51:25PM +0200, Andreas Falkenhahn wrote:
> I'm trying to compile libzip on Windows using CMake to generate
> makefiles. Libzip needs zlib so I'm doing the following:
>       mkdir build
>       cd build
>       cmake -DZLIB_LIBRARY=../../../zlib-1.2.11 
> -DZLIB_INCLUDE_DIR=../../../zlib-1.2.11 ..
> This doesn't work, however. I get the following error:
>       CMake Error at C:/Program Files 
> (x86)/CMake/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138 
> (message):
>       Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
> Why is that? I have defined ZLIB_LIBRARY and ZLIB_INCLUDE_DIR to point
> to the latest zlib.
> I've also tried the following:
>       mkdir build
>       cd build
>       cmake .. -DZLIB_LIBRARY=../../../zlib-1.2.11 
> -DZLIB_INCLUDE_DIR=../../../zlib-1.2.11
> When I run CMake like this, I get the following two warnings:
>       CMake Warning:
>       Manually-specified variables were not used by the project:
> In comparison to the first approach, however, build files are now written to 
> my build
> directory. When running nmake, however, only zlib seems to get built. libzip 
> itself
> isn't built at all.

This confuses me. We do not distribute infrastructure to build zlib.
zlib needs to be built first separately.

> I'm out of ideas here. What am I doing wrong?

When I run it locally (just 'cmake ..', and on NetBSD, not Linux) I get


in my CMakeCache.txt file. So it seems that ZLIB_LIBRARY might have to
point to the actual library and not a directory.

Hope this helps,

Made by MHonArc.