2020-04-07 08:33:49 +00:00
|
|
|
option (USE_INTERNAL_ZLIB_LIBRARY "Set to FALSE to use system zlib library instead of bundled" ${NOT_UNBUNDLED})
|
2017-02-28 23:49:04 +00:00
|
|
|
|
2019-05-15 17:19:39 +00:00
|
|
|
if (NOT MSVC)
|
|
|
|
set (INTERNAL_ZLIB_NAME "zlib-ng" CACHE INTERNAL "")
|
|
|
|
else ()
|
|
|
|
set (INTERNAL_ZLIB_NAME "zlib" CACHE INTERNAL "")
|
|
|
|
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/${INTERNAL_ZLIB_NAME}")
|
|
|
|
message (WARNING "Will use standard zlib, please clone manually:\n git clone https://github.com/madler/zlib.git ${ClickHouse_SOURCE_DIR}/contrib/${INTERNAL_ZLIB_NAME}")
|
2020-08-14 15:44:04 +00:00
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal zlib library")
|
2019-05-15 17:19:39 +00:00
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/${INTERNAL_ZLIB_NAME}/zlib.h")
|
|
|
|
if(USE_INTERNAL_ZLIB_LIBRARY)
|
|
|
|
message(WARNING "submodule contrib/${INTERNAL_ZLIB_NAME} is missing. to fix try run: \n git submodule update --init --recursive")
|
2020-08-14 15:44:04 +00:00
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal zlib library")
|
2019-05-15 17:19:39 +00:00
|
|
|
endif()
|
|
|
|
set(USE_INTERNAL_ZLIB_LIBRARY 0)
|
|
|
|
set(MISSING_INTERNAL_ZLIB_LIBRARY 1)
|
|
|
|
endif()
|
|
|
|
|
2017-02-07 21:28:13 +00:00
|
|
|
if (NOT USE_INTERNAL_ZLIB_LIBRARY)
|
2017-04-01 07:20:54 +00:00
|
|
|
find_package (ZLIB)
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT ZLIB_FOUND)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system zlib library")
|
2020-08-17 18:47:16 +00:00
|
|
|
else()
|
|
|
|
set (ZLIB_NAME "libz")
|
2020-08-14 15:44:04 +00:00
|
|
|
endif()
|
2017-02-07 21:28:13 +00:00
|
|
|
endif ()
|
|
|
|
|
2019-05-15 17:19:39 +00:00
|
|
|
if (NOT ZLIB_FOUND AND NOT MISSING_INTERNAL_ZLIB_LIBRARY)
|
2021-09-03 08:30:03 +00:00
|
|
|
# https://github.com/zlib-ng/zlib-ng/pull/733
|
|
|
|
# This is disabed by default
|
|
|
|
add_compile_definitions(Z_TLS=__thread)
|
2017-04-01 07:20:54 +00:00
|
|
|
set (USE_INTERNAL_ZLIB_LIBRARY 1)
|
2018-12-27 15:23:37 +00:00
|
|
|
set (ZLIB_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/${INTERNAL_ZLIB_NAME}" "${ClickHouse_BINARY_DIR}/contrib/${INTERNAL_ZLIB_NAME}" CACHE INTERNAL "") # generated zconf.h
|
2017-10-13 18:58:19 +00:00
|
|
|
set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) # for poco
|
2018-12-27 15:23:37 +00:00
|
|
|
set (ZLIB_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIR}) # for protobuf
|
2017-10-13 18:58:19 +00:00
|
|
|
set (ZLIB_FOUND 1) # for poco
|
2020-02-28 00:07:42 +00:00
|
|
|
set (ZLIB_LIBRARIES zlib CACHE INTERNAL "")
|
2021-01-14 22:51:55 +00:00
|
|
|
set (ZLIB_LIBRARY_NAME ${ZLIB_LIBRARIES}) # for cassandra
|
2020-08-17 18:47:16 +00:00
|
|
|
set (ZLIB_NAME "${INTERNAL_ZLIB_NAME}")
|
2017-02-07 21:28:13 +00:00
|
|
|
endif ()
|
|
|
|
|
2020-08-17 18:47:16 +00:00
|
|
|
message (STATUS "Using ${ZLIB_NAME}: ${ZLIB_INCLUDE_DIR} : ${ZLIB_LIBRARIES}")
|