2021-01-03 17:17:28 +00:00
|
|
|
if (NOT ARCH_ARM AND OPENSSL_FOUND)
|
2019-10-05 19:25:31 +00:00
|
|
|
option (ENABLE_RDKAFKA "Enable kafka" ${ENABLE_LIBRARIES})
|
2020-08-14 15:44:04 +00:00
|
|
|
elseif(ENABLE_RDKAFKA AND NOT OPENSSL_FOUND)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use librdkafka without SSL")
|
|
|
|
elseif(ENABLE_RDKAFKA)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "librdafka is not supported on ARM and on FreeBSD")
|
2018-11-10 20:09:07 +00:00
|
|
|
endif ()
|
2017-10-14 00:53:01 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT ENABLE_RDKAFKA)
|
|
|
|
if (USE_INTERNAL_RDKAFKA_LIBRARY)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal librdkafka with ENABLE_RDKAFKA=OFF")
|
|
|
|
endif()
|
|
|
|
return()
|
|
|
|
endif()
|
2017-10-14 00:53:01 +00:00
|
|
|
|
2020-09-29 08:56:37 +00:00
|
|
|
if (NOT ARCH_ARM)
|
2018-08-14 13:31:27 +00:00
|
|
|
option (USE_INTERNAL_RDKAFKA_LIBRARY "Set to FALSE to use system librdkafka instead of the bundled" ${NOT_UNBUNDLED})
|
2020-08-14 15:44:04 +00:00
|
|
|
elseif(USE_INTERNAL_RDKAFKA_LIBRARY)
|
2020-09-29 08:56:37 +00:00
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal librdkafka with ARCH_ARM=${ARCH_ARM}")
|
2018-08-14 13:31:27 +00:00
|
|
|
endif ()
|
2017-10-06 04:40:18 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/cppkafka/CMakeLists.txt")
|
|
|
|
if(USE_INTERNAL_RDKAFKA_LIBRARY)
|
|
|
|
message (WARNING "submodule contrib/cppkafka is missing. to fix try run: \n git submodule update --init --recursive")
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal cppkafka")
|
|
|
|
set (USE_INTERNAL_RDKAFKA_LIBRARY 0)
|
|
|
|
endif()
|
|
|
|
set (MISSING_INTERNAL_CPPKAFKA_LIBRARY 1)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/librdkafka/CMakeLists.txt")
|
|
|
|
if(USE_INTERNAL_RDKAFKA_LIBRARY OR MISSING_INTERNAL_CPPKAFKA_LIBRARY)
|
|
|
|
message (WARNING "submodule contrib/librdkafka is missing. to fix try run: \n git submodule update --init --recursive")
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal rdkafka")
|
|
|
|
set (USE_INTERNAL_RDKAFKA_LIBRARY 0)
|
|
|
|
endif()
|
|
|
|
set (MISSING_INTERNAL_RDKAFKA_LIBRARY 1)
|
2017-10-20 17:59:44 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-10-06 04:40:18 +00:00
|
|
|
if (NOT USE_INTERNAL_RDKAFKA_LIBRARY)
|
2018-01-15 18:57:10 +00:00
|
|
|
find_library (RDKAFKA_LIB rdkafka)
|
2017-10-06 04:40:18 +00:00
|
|
|
find_path (RDKAFKA_INCLUDE_DIR NAMES librdkafka/rdkafka.h PATHS ${RDKAFKA_INCLUDE_PATHS})
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT RDKAFKA_LIB OR NOT RDKAFKA_INCLUDE_DIR)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system librdkafka")
|
|
|
|
endif()
|
|
|
|
|
2018-08-05 08:54:57 +00:00
|
|
|
if (USE_STATIC_LIBRARIES AND NOT OS_FREEBSD)
|
2018-01-20 23:23:19 +00:00
|
|
|
find_library (SASL2_LIBRARY sasl2)
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT SASL2_LIBRARY)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system sasl2 library needed for static librdkafka")
|
|
|
|
endif()
|
2018-01-20 23:23:19 +00:00
|
|
|
endif ()
|
2019-01-14 13:06:14 +00:00
|
|
|
set (CPPKAFKA_LIBRARY cppkafka) # TODO: try to use unbundled version.
|
2017-10-06 04:40:18 +00:00
|
|
|
endif ()
|
|
|
|
|
2018-01-15 18:57:10 +00:00
|
|
|
if (RDKAFKA_LIB AND RDKAFKA_INCLUDE_DIR)
|
2017-10-20 17:59:44 +00:00
|
|
|
set (USE_RDKAFKA 1)
|
2020-08-21 22:10:29 +00:00
|
|
|
add_library (rdkafka_imp UNKNOWN IMPORTED)
|
|
|
|
set_target_properties (rdkafka_imp PROPERTIES IMPORTED_LOCATION ${RDKAFKA_LIB})
|
|
|
|
set_target_properties (rdkafka_imp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${RDKAFKA_INCLUDE_DIR})
|
|
|
|
|
|
|
|
set (RDKAFKA_LIBRARY rdkafka_imp ${OPENSSL_LIBRARIES})
|
2018-12-27 13:27:01 +00:00
|
|
|
set (CPPKAFKA_LIBRARY cppkafka)
|
2018-01-20 23:23:19 +00:00
|
|
|
if (SASL2_LIBRARY)
|
|
|
|
list (APPEND RDKAFKA_LIBRARY ${SASL2_LIBRARY})
|
|
|
|
endif ()
|
2018-05-05 12:31:47 +00:00
|
|
|
if (LZ4_LIBRARY)
|
|
|
|
list (APPEND RDKAFKA_LIBRARY ${LZ4_LIBRARY})
|
|
|
|
endif ()
|
2020-08-14 15:44:04 +00:00
|
|
|
elseif (NOT MISSING_INTERNAL_RDKAFKA_LIBRARY AND NOT MISSING_INTERNAL_CPPKAFKA_LIBRARY AND NOT ARCH_ARM)
|
2017-10-06 04:40:18 +00:00
|
|
|
set (USE_INTERNAL_RDKAFKA_LIBRARY 1)
|
|
|
|
set (RDKAFKA_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/librdkafka/src")
|
|
|
|
set (RDKAFKA_LIBRARY rdkafka)
|
2018-12-27 13:27:01 +00:00
|
|
|
set (CPPKAFKA_LIBRARY cppkafka)
|
2017-10-20 17:59:44 +00:00
|
|
|
set (USE_RDKAFKA 1)
|
2020-08-14 15:44:04 +00:00
|
|
|
elseif(ARCH_ARM)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Using internal rdkafka on ARM is not supported")
|
2017-10-14 00:53:01 +00:00
|
|
|
endif ()
|
|
|
|
|
2018-12-27 13:27:01 +00:00
|
|
|
message (STATUS "Using librdkafka=${USE_RDKAFKA}: ${RDKAFKA_INCLUDE_DIR} : ${RDKAFKA_LIBRARY} ${CPPKAFKA_LIBRARY}")
|