From 16adb8c4d630511d0f1eb896fe9b5a868c712000 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 17 Jan 2022 22:58:31 +0300 Subject: [PATCH] Remove unbundled cassandra support --- CMakeLists.txt | 1 - cmake/find/cassandra.cmake | 34 -------------------------- contrib/CMakeLists.txt | 4 +-- contrib/cassandra-cmake/CMakeLists.txt | 27 ++++++++++++++------ src/Dictionaries/CMakeLists.txt | 4 +-- src/configure_config.cmake | 3 +++ 6 files changed, 26 insertions(+), 47 deletions(-) delete mode 100644 cmake/find/cassandra.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index cd627d7d5c5..e026a86792a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -510,7 +510,6 @@ include (cmake/find/yaml-cpp.cmake) include (cmake/find/nlp.cmake) include (cmake/find/filelog.cmake) include (cmake/find/msgpack.cmake) -include (cmake/find/cassandra.cmake) include (cmake/find/sentry.cmake) include (cmake/find/datasketches.cmake) diff --git a/cmake/find/cassandra.cmake b/cmake/find/cassandra.cmake deleted file mode 100644 index 7fcbdbb90a5..00000000000 --- a/cmake/find/cassandra.cmake +++ /dev/null @@ -1,34 +0,0 @@ -if (MISSING_INTERNAL_LIBUV_LIBRARY) - message (WARNING "Disabling cassandra due to missing libuv") - set (ENABLE_CASSANDRA OFF CACHE INTERNAL "") -endif() - -option(ENABLE_CASSANDRA "Enable Cassandra" ${ENABLE_LIBRARIES}) - -if (NOT ENABLE_CASSANDRA) - return() -endif() - -if (APPLE) - set(CMAKE_MACOSX_RPATH ON) -endif() - -if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/cassandra") - message (ERROR "submodule contrib/cassandra is missing. to fix try run: \n git submodule update --init") - message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal Cassandra") - set (USE_CASSANDRA 0) - return() -endif() - -set (USE_CASSANDRA 1) -set (CASSANDRA_INCLUDE_DIR - "${ClickHouse_SOURCE_DIR}/contrib/cassandra/include/") -if (MAKE_STATIC_LIBRARIES) - set (CASSANDRA_LIBRARY cassandra_static) -else() - set (CASSANDRA_LIBRARY cassandra) -endif() - -set (CASS_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/cassandra") - -message (STATUS "Using cassandra=${USE_CASSANDRA}: ${CASSANDRA_INCLUDE_DIR} : ${CASSANDRA_LIBRARY}") diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index b3555e848dc..a26c505f161 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -149,9 +149,7 @@ endif() add_subdirectory (libuv-cmake) add_subdirectory (amqpcpp-cmake) # requires: libuv -if (USE_CASSANDRA) - add_subdirectory (cassandra-cmake) -endif() +add_subdirectory (cassandra-cmake) # requires: libuv # Should go before: # - sentry-native diff --git a/contrib/cassandra-cmake/CMakeLists.txt b/contrib/cassandra-cmake/CMakeLists.txt index 15565ec0a8d..cc4f12f2e83 100644 --- a/contrib/cassandra-cmake/CMakeLists.txt +++ b/contrib/cassandra-cmake/CMakeLists.txt @@ -1,3 +1,14 @@ +option(ENABLE_CASSANDRA "Enable Cassandra" ${ENABLE_LIBRARIES}) + +if (NOT ENABLE_CASSANDRA) + message(STATUS "Not using cassandra") + return() +endif() + +if (APPLE) + set(CMAKE_MACOSX_RPATH ON) +endif() + # Need to use C++17 since the compilation is not possible with C++20 currently. set (CMAKE_CXX_STANDARD 17) @@ -108,20 +119,22 @@ configure_file( ${CMAKE_CURRENT_BINARY_DIR}/driver_config.hpp) -add_library(cassandra +add_library(_cassandra ${SOURCES} $ $ $ $) -target_link_libraries(cassandra ch_contrib::zlib) -add_library(cassandra_static ALIAS cassandra) -target_include_directories(cassandra PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${INCLUDE_DIRS}) -target_compile_definitions(cassandra PRIVATE CASS_BUILDING) +target_link_libraries(_cassandra ch_contrib::zlib) +target_include_directories(_cassandra PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${INCLUDE_DIRS}) +target_include_directories(_cassandra SYSTEM BEFORE PUBLIC ${CASS_INCLUDE_DIR}) +target_compile_definitions(_cassandra PRIVATE CASS_BUILDING) -target_link_libraries(cassandra uv) +target_link_libraries(_cassandra ch_contrib::uv) if(CASS_USE_OPENSSL) - target_link_libraries(cassandra ssl) + target_link_libraries(_cassandra OpenSSL::SSL) endif() + +add_library(ch_contrib::cassandra ALIAS _cassandra) diff --git a/src/Dictionaries/CMakeLists.txt b/src/Dictionaries/CMakeLists.txt index bd2aa80f6d8..31b1ac67304 100644 --- a/src/Dictionaries/CMakeLists.txt +++ b/src/Dictionaries/CMakeLists.txt @@ -37,8 +37,8 @@ target_link_libraries(clickhouse_dictionaries PUBLIC abseil_swiss_tables) -if(USE_CASSANDRA) - target_include_directories(clickhouse_dictionaries SYSTEM PRIVATE ${CASSANDRA_INCLUDE_DIR}) +if (TARGET ch_contrib::cassandra) + target_link_libraries(clickhouse_dictionaries PRIVATE ch_contrib::cassandra) endif() add_subdirectory(Embedded) diff --git a/src/configure_config.cmake b/src/configure_config.cmake index a16521ee880..d391870f0eb 100644 --- a/src/configure_config.cmake +++ b/src/configure_config.cmake @@ -46,3 +46,6 @@ endif() if (TARGET ch_contrib::amqp_cpp) set(USE_AMQPCPP 1) endif() +if (TARGET ch_contrib::cassandra) + set(USE_CASSANDRA 1) +endif()