Cmake can not find ZLIB on Ubuntu 20.04

I am running Ubuntu 20.04 on Windows Subsystem for linux. Cmake is version 3.16.3. I am trying to build a project with a zlib dependency, and I get the following error...

 Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
Call Stack (most recent call first): /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.16/Modules/FindZLIB.cmake:115 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:1224 (find_package)

Package zlib1g is installed.

How can I rectify this?

2

2 Answers

This seems to be a bug in CMake: .

My workaround for this issue was to include the library in the command line, like this:

cmake -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.so ..
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like