My project (exiv2.org) 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(...)