Summary
Are you having trouble trying to build CMake with ZLib options? If so, this document should provide an explanation and instructions to correct this error.
Affected Development Environment
- Platform: Linux, Mac, and/or Windows
- Compiler/builder: CMake
Overview
ZLib is an open-source library used for data compression and decompression. This error occurs because CMake does not recognize the ZLib library and include directories when trying to build the project.
Steps to Fix
In order to fix this error, make sure you have downloaded and included the library and headers of ZLib in your environment.
- Download the latest version of ZLib from here.
- Follow the instructions included in the
README
file to install the library. - On Linux and Mac systems, the library should be installed in
/usr/lib
and the headers should be installed in/usr/include
. - On Windows systems, the library (
zlib1.dll
) should be copied into CMake'sbin
directory. - Once the library is installed, using
-D
compile options provide the library and include directories to the CMake build definition. -DZLIB_LIBRARY:FILEPATH=<path to the library> -DZLIB_INCLUDE_DIR:PATH=<path to the headers>
You should now be able to build the project with CMake without any errors.
FAQ
- What is ZLib used for?
- ZLib is an open-source library used for data compression and decompression.
- Where can I download the library?
- You can download the latest version of ZLib from here.
- What are the
-D
compile options to provide the library and include directories to CMake build definition?
-DZLIB_LIBRARY:FILEPATH=<path to the library> -DZLIB_INCLUDE_DIR:PATH=<path to the headers>
- Where can I find instructions for installing the library on my system?
- The instructions for installation can be found in the
README
file included with the download.
- On what platforms is ZLib supported?
- ZLib is supported on Linux, Mac, and Windows systems.