2019-10-05 19:25:31 +00:00
|
|
|
option(ENABLE_PROTOBUF "Enable protobuf" ${ENABLE_LIBRARIES})
|
2019-03-13 07:37:16 +00:00
|
|
|
|
2020-08-13 20:10:06 +00:00
|
|
|
if(ENABLE_PROTOBUF)
|
2019-03-13 07:37:16 +00:00
|
|
|
|
2019-01-25 20:02:03 +00:00
|
|
|
option(USE_INTERNAL_PROTOBUF_LIBRARY "Set to FALSE to use system protobuf instead of bundled" ${NOT_UNBUNDLED})
|
2018-11-19 08:17:09 +00:00
|
|
|
|
2019-01-25 20:02:03 +00:00
|
|
|
if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/protobuf/cmake/CMakeLists.txt")
|
|
|
|
if(USE_INTERNAL_PROTOBUF_LIBRARY)
|
|
|
|
message(WARNING "submodule contrib/protobuf is missing. to fix try run: \n git submodule update --init --recursive")
|
|
|
|
set(USE_INTERNAL_PROTOBUF_LIBRARY 0)
|
|
|
|
endif()
|
|
|
|
set(MISSING_INTERNAL_PROTOBUF_LIBRARY 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT USE_INTERNAL_PROTOBUF_LIBRARY)
|
2018-11-19 08:17:09 +00:00
|
|
|
find_package(Protobuf)
|
2019-01-25 20:02:03 +00:00
|
|
|
endif()
|
2018-11-19 08:17:09 +00:00
|
|
|
|
|
|
|
if (Protobuf_LIBRARY AND Protobuf_INCLUDE_DIR)
|
2019-01-25 20:02:03 +00:00
|
|
|
set(USE_PROTOBUF 1)
|
|
|
|
elseif(NOT MISSING_INTERNAL_PROTOBUF_LIBRARY)
|
|
|
|
set(Protobuf_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/protobuf/src)
|
2018-11-19 08:17:09 +00:00
|
|
|
|
2019-01-25 20:02:03 +00:00
|
|
|
set(USE_PROTOBUF 1)
|
|
|
|
set(USE_INTERNAL_PROTOBUF_LIBRARY 1)
|
2018-11-19 08:17:09 +00:00
|
|
|
set(Protobuf_LIBRARY libprotobuf)
|
|
|
|
set(Protobuf_PROTOC_LIBRARY libprotoc)
|
|
|
|
set(Protobuf_LITE_LIBRARY libprotobuf-lite)
|
|
|
|
|
2020-04-27 17:46:41 +00:00
|
|
|
set(Protobuf_PROTOC_EXECUTABLE "$<TARGET_FILE:protoc>")
|
2018-11-19 08:17:09 +00:00
|
|
|
endif()
|
|
|
|
|
2019-03-12 09:55:43 +00:00
|
|
|
if(OS_FREEBSD AND SANITIZE STREQUAL "address")
|
|
|
|
# ../contrib/protobuf/src/google/protobuf/arena_impl.h:45:10: fatal error: 'sanitizer/asan_interface.h' file not found
|
|
|
|
# #include <sanitizer/asan_interface.h>
|
|
|
|
if(LLVM_INCLUDE_DIRS)
|
|
|
|
set(Protobuf_INCLUDE_DIR ${Protobuf_INCLUDE_DIR} ${LLVM_INCLUDE_DIRS})
|
|
|
|
else()
|
|
|
|
set(USE_PROTOBUF 0)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-05-22 20:45:13 +00:00
|
|
|
include (${ClickHouse_SOURCE_DIR}/cmake/protobuf_generate_cpp.cmake)
|
2020-08-13 20:10:06 +00:00
|
|
|
endif()
|
2019-03-13 07:37:16 +00:00
|
|
|
|
2019-10-05 19:25:31 +00:00
|
|
|
message(STATUS "Using protobuf=${USE_PROTOBUF}: ${Protobuf_INCLUDE_DIR} : ${Protobuf_LIBRARY} : ${Protobuf_PROTOC_EXECUTABLE}")
|