ClickHouse/cmake/find/grpc.cmake
Konstantin Podshumok fe56697893 cmake: Add option to fail configuration instead of auto-reconfiguration
squashed:
find/msgpack.cmake - merge collision fix, trivial

Signed-off-by: Konstantin Podshumok <kpp.live+signed@gmail.com>
2020-08-09 21:37:26 +03:00

39 lines
1.4 KiB
CMake

option (ENABLE_GRPC "Use gRPC" ${ENABLE_LIBRARIES})
if (NOT ENABLE_GRPC)
if (USE_INTERNAL_GRPC_LIBRARY)
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal gRPC library with ENABLE_GRPC=OFF")
endif()
return()
endif()
option (USE_INTERNAL_GRPC_LIBRARY "Set to FALSE to use system gRPC library instead of bundled" ${NOT_UNBUNDLED})
if (NOT USE_INTERNAL_GRPC_LIBRARY)
find_package(grpc)
if (GRPC_INCLUDE_DIR AND GRPC_LIBRARY)
set (USE_GRPC ON)
else()
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system gRPC")
endif()
endif()
if (NOT USE_GRPC)
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/grpc/include/grpc++/grpc++.h")
message (WARNING "submodule contrib/grpc is missing. To fix try run: \n git submodule update --init --recursive")
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal gRPC")
set (USE_INTERNAL_GRPC_LIBRARY OFF)
elseif (NOT USE_PROTOBUF)
message (WARNING "gRPC requires protobuf which is disabled")
message (${RECONFIGURE_MESSAGE_LEVEL} "Will not use internal gRPC without protobuf")
set (USE_INTERNAL_GRPC_LIBRARY OFF)
else()
set (GRPC_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/grpc/include")
set (GRPC_LIBRARY "libgrpc++")
set (USE_GRPC ON)
set (USE_INTERNAL_GRPC_LIBRARY ON)
endif()
endif()
message (STATUS "Using gRPC=${USE_GRPC}: ${GRPC_INCLUDE_DIR} : ${GRPC_LIBRARY}")