zlib is not added to the linker when png lib is used
To fix this issue we should replace
target_link_libraries(mapcache ${PNG_LIBRARY})
with
target_link_libraries(mapcache ${PNG_LIBRARIES})
Given mapcache does not directly link to zlib, I'd prefer if this was done only for platforms which need to explicitely add zlib, i.e. use PNG_LIBRARIES on wondows but keep using PNG_LIBRARY on *nix.
In my understanding this is the case when libpng is being built as a static lib so we might also add a switch for that (USE_STATIC_LIBPNG or something like this). Anyway mapserver is also using PNG_LIBRARIES in CMakeLists.txt without any problems.
@szekerest thanks for the mention of the workaround "target_link_libraries(mapcache ${PNG_LIBRARIES})"
For the record, this issue still exists with MapCache 1.4.0