add a libuv.cmake

This commit is contained in:
benbiti 2021-04-18 09:35:24 +08:00
parent 0b0093fa4d
commit e1ff6b5629
3 changed files with 23 additions and 20 deletions

View File

@ -9,9 +9,9 @@ if (NOT ENABLE_AMQPCPP)
return()
endif()
include(cmake/find/libuv.cmake)
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libuv")
message (ERROR "submodule contrib/libuv is missing. to fix try run: \n git submodule update --init --recursive")
if (MISSING_INTERNAL_LIBUV_LIBRARY)
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal libuv needed for AMQP-CPP library")
set (USE_AMQPCPP 0)
return()
@ -27,15 +27,6 @@ endif ()
set (USE_AMQPCPP 1)
set (AMQPCPP_LIBRARY amqp-cpp)
if (MAKE_STATIC_LIBRARIES)
set (LIBUV_LIBRARY uv_a)
else()
set (LIBUV_LIBRARY uv)
endif()
set (LIBUV_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/libuv")
set (LIBUV_INCLUDE_DIR "${LIBUV_ROOT_DIR}/include")
set (AMQPCPP_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/AMQP-CPP/include")
list (APPEND AMQPCPP_INCLUDE_DIR
"${LIBUV_INCLUDE_DIR}"
@ -43,8 +34,4 @@ list (APPEND AMQPCPP_INCLUDE_DIR
list (APPEND AMQPCPP_LIBRARY "${LIBUV_LIBRARY}")
# Assign libuv include and libraries
#set(CASS_LIBS ${CASS_LIBS} ${LIBUV_LIBRARIES})
message (STATUS "Using AMQP-CPP=${USE_AMQPCPP}: ${AMQPCPP_INCLUDE_DIR} : ${AMQPCPP_LIBRARY}")
message (STATUS "Using libuv: ${LIBUV_ROOT_DIR} : ${LIBUV_LIBRARY}")

View File

@ -13,21 +13,20 @@ if (APPLE)
set(CMAKE_MACOSX_RPATH ON)
endif()
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libuv")
include(cmake/find/libuv.cmake)
if (MISSING_INTERNAL_LIBUV_LIBRARY)
message (ERROR "submodule contrib/libuv is missing. to fix try run: \n git submodule update --init --recursive")
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal libuv needed for Cassandra")
elseif (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/cassandra")
message (ERROR "submodule contrib/cassandra is missing. to fix try run: \n git submodule update --init --recursive")
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal Cassandra")
else()
set (LIBUV_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/libuv")
set (CASSANDRA_INCLUDE_DIR
"${ClickHouse_SOURCE_DIR}/contrib/cassandra/include/")
if (MAKE_STATIC_LIBRARIES)
set (LIBUV_LIBRARY uv_a)
set (CASSANDRA_LIBRARY cassandra_static)
else()
set (LIBUV_LIBRARY uv)
set (CASSANDRA_LIBRARY cassandra)
endif()
@ -36,4 +35,4 @@ else()
endif()
message (STATUS "Using cassandra=${USE_CASSANDRA}: ${CASSANDRA_INCLUDE_DIR} : ${CASSANDRA_LIBRARY}")
message (STATUS "Using libuv: ${LIBUV_ROOT_DIR} : ${LIBUV_LIBRARY}")

17
cmake/find/libuv.cmake Normal file
View File

@ -0,0 +1,17 @@
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libuv")
message (WARNING "submodule contrib/libuv is missing. to fix try run: \n git submodule update --init --recursive")
SET(MISSING_INTERNAL_LIBUV_LIBRARY 1)
return()
endif()
if (MAKE_STATIC_LIBRARIES)
set (LIBUV_LIBRARY uv_a)
else()
set (LIBUV_LIBRARY uv)
endif()
set (LIBUV_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/libuv")
set (LIBUV_INCLUDE_DIR "${LIBUV_ROOT_DIR}/include")
message (STATUS "Using libuv: ${LIBUV_ROOT_DIR} : ${LIBUV_LIBRARY}")