This allows us to use standard cmake utilities to point to non-system zlib locations.
|27 ↗||(On Diff #119321)|
This shouldn't be here.
|25 ↗||(On Diff #119321)|
The correct variable to use here is ZLIB_LIBRARIES. While ZLIB_LIBRARY probably works in most cases, it is an implementation detail of the FindZLIB CMake package.
Reverted in r316029 because the bots got angry at me:
CMake Error at /usr/local/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message): Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) Call Stack (most recent call first): /usr/local/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) /usr/local/share/cmake-3.7/Modules/FindZLIB.cmake:114 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) cmake/config-ix.cmake:135 (find_package) CMakeLists.txt:585 (include)
@beanz, do you have an idea what went wrong?
I assume this would fix it:
find_package(ZLIB) if (ZLIB_FOUND) set(HAVE_LIBZ 1) else() check_library_exists(z compress2 "" HAVE_LIBZ) if(HAVE_LIBZ) set(ZLIB_LIBRARIES z) endif() endif()
The question is whether that's the right thing to do.