c++cmakezlibopenexr

CMake zlib Dependency Error on Windows


I'm trying to build OpenEXR 2.2 on Windows, but the instructions that came with the download aren't working as expected. The instructions for IlmBase worked, but once I get to the OpenEXR instructions, it fails because of zlib. The steps at this point are:

3. Go to http://www.zlib.net and download zlib 

So I went to this website and in the section that starts with: The current release is publicly available here: I downloaded zlib source code, version 1.2.8, zipfile format...

Then, I moved on to the next step, which is where I get the error:

4. Launch a command window, navigate to the OpenEXR folder with 
CMakeLists.txt, and type command:     
    setlocal
    del /f CMakeCache.txt
    cmake 
      -DZLIB_ROOT=<zlib location>
      -DILMBASE_PACKAGE_PREFIX=<where you installed the ilmbase builds>
      -DCMAKE_INSTALL_PREFIX=<where you want to instal the openexr builds>
      -G "Visual Studio 10 Win64" ^
      ..\openexr

So here's the command I type:

cmake -DZLIB_ROOT=C:\Users\erik\Documents\zlib-1.2.8 -DILMBASE_PACKAGE_PREFIX=C:\Users\erik\Documents\ilmbase-2.2.0\bin -DCMAKE_INSTALL_PREFIX=C:\Users\erik\Documents\ilmbase-2.2.0\bin -G "Visual Studio 10 Win64" ^..\openexr-2.2.0

And here's the error I get:

Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.8")

First problem is, the instructions don't say anything about ZLIB_LIBRARY. Second is, the zlib download looks like it's all source code. No .lib or .dll files are involved.


Solution

  • You have downloaded only the source code. You need to compile it first. Or download the pre-compiled DLL: "zlib compiled DLL" from the zlib homepage.

    ZLIB_LIBRARY will be derived from ZLIB_DIR, so this part is correct.