ClickHouse/cmake/find_zlib.cmake
proller 70e35d0bcc Build fixes (#1718)
* Embedded compiler fixes

* common lib not needed for clang and lld

* Fix pthread link

* Fix shared build

* Arm fixes 1

* arm fix

* Unused fix

* Build fixes

* release --pbuilder

* release pbuilder fix

* FORCE_PBUILDER_CREATE=1 release

* release: Auto use clang with sanitizers

* Fix build without poco data odbc lib. zlib arm build fix.

* Fix freebsd build and build without mysql

* Tests: Dont eat my cpu!

* Test me
2017-12-29 18:48:20 +03:00

29 lines
1.0 KiB
CMake

option (USE_INTERNAL_ZLIB_LIBRARY "Set to FALSE to use system zlib library instead of bundled" ${NOT_UNBUNDLED})
if (NOT USE_INTERNAL_ZLIB_LIBRARY)
find_package (ZLIB)
endif ()
if (NOT ZLIB_FOUND)
set (USE_INTERNAL_ZLIB_LIBRARY 1)
set (ZLIB_COMPAT 1) # for zlib-ng, also enables WITH_GZFILEOP
set (WITH_NATIVE_INSTRUCTIONS ${ARCHNATIVE})
if (CMAKE_SYSTEM MATCHES "FreeBSD" OR ARCH_I386)
set (WITH_OPTIM 0 CACHE INTERNAL "") # Bug in assembler
endif ()
if (ARCH_AARCH64)
set(WITH_NEON 1 CACHE INTERNAL "")
set(WITH_ACLE 1 CACHE INTERNAL "")
endif ()
set (ZLIB_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/zlib-ng" "${ClickHouse_BINARY_DIR}/contrib/zlib-ng") # generated zconf.h
set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) # for poco
set (ZLIB_FOUND 1) # for poco
if (USE_STATIC_LIBRARIES)
set (ZLIB_LIBRARIES zlibstatic)
else ()
set (ZLIB_LIBRARIES zlib)
endif ()
endif ()
message (STATUS "Using zlib: ${ZLIB_INCLUDE_DIR} : ${ZLIB_LIBRARIES}")