CMake Visual Studio zlib zlibstatic.lib

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

CMake Visual Studio zlib zlibstatic.lib


My project ( uses zlib and is builds well on all platforms (Linux,
Cygwin, MacOS-X and Visual Studio) with CMake.

A user complained that the CMake/Visual Studio static builds link zlib.dll
(zlibd.dll for debug) and wants to link zlibstatic.lib (zlibstaticd.lib). 
I've tracked this down to FindZlib.cmake which sets ZLIB_FOUND,
ZLIB_LIBRARIES and ZLIB_INCLUDE_DIRS to use the zlib dynamic libraries.  For
the moment, I have a work-around which externally copies zlibstatic.lib to
overwrite zlib.lib.

I've inspected the code in FindZlib.cmake and it doesn't appear to know
about zlibstatic.  I've unsuccessfully tried to use string(REPLACE ...) on
ZLIB_LIBRARIES.  I don't know CMake very well.  Is ZLIB_LIBRARIES a string
or a list of strings?  How can I either edit it, or get a new variable
ZLIB_STATIC_LIBRARIES to pass to target_link_libraries(...)

Any suggestions?  All help appreciated.

Robin Mills


Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: