ClickHouse/src/CMakeLists.txt

614 lines
21 KiB
CMake
Raw Normal View History

if (USE_INCLUDE_WHAT_YOU_USE)
set (CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_PATH})
endif ()
if (USE_CLANG_TIDY)
2020-03-08 20:17:49 +00:00
set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_PATH}")
endif ()
if(COMPILER_PIPE)
set(MAX_COMPILER_MEMORY 2500)
2018-12-27 15:23:37 +00:00
else()
set(MAX_COMPILER_MEMORY 1500)
endif()
if(USE_STATIC_LIBRARIES)
set(MAX_LINKER_MEMORY 3500)
else()
set(MAX_LINKER_MEMORY 2500)
endif()
include(../cmake/limit_jobs.cmake)
2018-12-27 15:23:37 +00:00
set (CONFIG_VERSION "${CMAKE_CURRENT_BINARY_DIR}/Common/config_version.h")
set (CONFIG_COMMON "${CMAKE_CURRENT_BINARY_DIR}/Common/config.h")
include (../cmake/version.cmake)
message (STATUS "Will build ${VERSION_FULL} revision ${VERSION_REVISION} ${VERSION_OFFICIAL}")
2022-01-16 10:44:23 +00:00
include (configure_config.cmake)
configure_file (Common/config.h.in ${CONFIG_COMMON})
configure_file (Common/config_version.h.in ${CONFIG_VERSION})
configure_file (Core/config_core.h.in "${CMAKE_CURRENT_BINARY_DIR}/Core/include/config_core.h")
2021-03-31 10:28:58 +00:00
if (USE_DEBUG_HELPERS)
2022-01-18 06:48:25 +00:00
get_target_property(MAGIC_ENUM_INCLUDE_DIR ch_contrib::magic_enum INTERFACE_INCLUDE_DIRECTORIES)
2022-01-17 04:33:47 +00:00
# CMake generator expression will do insane quoting when it encounters special character like quotes, spaces, etc.
# Prefixing "SHELL:" will force it to use the original text.
set (INCLUDE_DEBUG_HELPERS "SHELL:-I\"${ClickHouse_SOURCE_DIR}/base\" -I\"${MAGIC_ENUM_INCLUDE_DIR}\" -include \"${ClickHouse_SOURCE_DIR}/src/Core/iostream_debug_helpers.h\"")
# Use generator expression as we don't want to pollute CMAKE_CXX_FLAGS, which will interfere with CMake check system.
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:${INCLUDE_DEBUG_HELPERS}>)
2021-03-31 10:28:58 +00:00
endif ()
2022-04-04 12:07:05 +00:00
# ClickHouse developers may use platform-dependent code under some macro (e.g. `#ifdef ENABLE_MULTITARGET`).
# If turned ON, this option defines such macro.
# See `src/Common/TargetSpecific.h`
option(ENABLE_MULTITARGET_CODE "Enable platform-dependent code" ON)
if (ENABLE_MULTITARGET_CODE)
add_definitions(-DENABLE_MULTITARGET_CODE=1)
else()
add_definitions(-DENABLE_MULTITARGET_CODE=0)
endif()
add_subdirectory (Access)
2021-08-18 22:19:14 +00:00
add_subdirectory (Backups)
add_subdirectory (Columns)
add_subdirectory (Common)
add_subdirectory (Core)
2021-10-15 20:18:20 +00:00
add_subdirectory (QueryPipeline)
add_subdirectory (DataTypes)
add_subdirectory (Dictionaries)
add_subdirectory (Disks)
add_subdirectory (Storages)
add_subdirectory (Parsers)
add_subdirectory (IO)
add_subdirectory (Functions)
add_subdirectory (Interpreters)
add_subdirectory (AggregateFunctions)
add_subdirectory (Client)
add_subdirectory (TableFunctions)
add_subdirectory (Processors)
add_subdirectory (Formats)
add_subdirectory (Compression)
add_subdirectory (Server)
2021-01-13 10:32:20 +00:00
add_subdirectory (Coordination)
2022-04-27 15:05:45 +00:00
add_subdirectory (Bridge)
add_subdirectory (Daemon)
add_subdirectory (Loggers)
set(dbms_headers)
set(dbms_sources)
add_headers_and_sources(clickhouse_common_io Common)
add_headers_and_sources(clickhouse_common_io Common/HashTable)
add_headers_and_sources(clickhouse_common_io IO)
add_headers_and_sources(clickhouse_common_io IO/Archives)
2020-09-18 23:04:36 +00:00
add_headers_and_sources(clickhouse_common_io IO/S3)
list (REMOVE_ITEM clickhouse_common_io_sources Common/malloc.cpp Common/new_delete.cpp)
2021-10-19 17:41:52 +00:00
add_headers_and_sources(dbms Disks/IO)
2022-05-22 11:51:48 +00:00
add_headers_and_sources(dbms Disks/ObjectStorages)
2022-01-17 20:53:49 +00:00
if (TARGET ch_contrib::sqlite)
2021-07-09 14:22:53 +00:00
add_headers_and_sources(dbms Databases/SQLite)
endif()
2021-05-17 11:02:35 +00:00
if (TARGET ch_contrib::rdkafka)
add_headers_and_sources(dbms Storages/Kafka)
endif()
2022-04-04 20:27:39 +00:00
add_headers_and_sources(dbms Storages/MeiliSearch)
2022-01-17 19:53:36 +00:00
if (TARGET ch_contrib::amqp_cpp)
2020-05-20 04:28:55 +00:00
add_headers_and_sources(dbms Storages/RabbitMQ)
endif()
2020-12-21 19:20:56 +00:00
if (USE_LIBPQXX)
add_headers_and_sources(dbms Core/PostgreSQL)
2020-12-21 19:20:56 +00:00
add_headers_and_sources(dbms Databases/PostgreSQL)
2021-01-15 21:23:58 +00:00
add_headers_and_sources(dbms Storages/PostgreSQL)
2020-12-21 19:20:56 +00:00
endif()
2022-01-16 10:44:23 +00:00
if (TARGET ch_contrib::rocksdb)
2020-11-08 15:41:16 +00:00
add_headers_and_sources(dbms Storages/RocksDB)
2020-09-02 09:13:59 +00:00
endif()
2022-01-18 06:48:23 +00:00
if (TARGET ch_contrib::aws_s3)
2020-05-27 15:02:25 +00:00
add_headers_and_sources(dbms Common/S3)
2022-05-22 11:51:48 +00:00
add_headers_and_sources(dbms Disks/ObjectStorages/S3)
endif()
2022-01-18 06:48:22 +00:00
if (TARGET ch_contrib::azure_sdk)
2022-05-22 11:51:48 +00:00
add_headers_and_sources(dbms Disks/ObjectStorages/AzureBlobStorage)
endif()
2022-01-17 18:45:53 +00:00
if (TARGET ch_contrib::hdfs)
add_headers_and_sources(dbms Storages/HDFS)
2022-05-22 11:51:48 +00:00
add_headers_and_sources(dbms Disks/ObjectStorages/HDFS)
endif()
2021-12-23 03:50:26 +00:00
add_headers_and_sources(dbms Storages/Cache)
2022-01-18 19:34:22 +00:00
if (TARGET ch_contrib::hivemetastore)
2021-11-22 02:52:10 +00:00
add_headers_and_sources(dbms Storages/Hive)
2021-07-03 17:14:56 +00:00
endif()
2021-06-09 02:03:36 +00:00
2022-01-17 21:38:43 +00:00
if (OS_LINUX)
2021-07-03 17:14:56 +00:00
add_headers_and_sources(dbms Storages/FileLog)
2022-01-17 21:38:43 +00:00
else()
message(STATUS "StorageFileLog is only supported on Linux")
endif ()
2021-06-09 02:03:36 +00:00
2017-11-21 19:17:24 +00:00
list (APPEND clickhouse_common_io_sources ${CONFIG_BUILD})
list (APPEND clickhouse_common_io_headers ${CONFIG_VERSION} ${CONFIG_COMMON})
2021-02-17 19:19:39 +00:00
list (APPEND dbms_sources Functions/IFunction.cpp Functions/FunctionFactory.cpp Functions/FunctionHelpers.cpp Functions/extractTimeZoneFromFunctionArguments.cpp Functions/replicate.cpp Functions/FunctionsLogical.cpp)
2021-05-17 07:30:42 +00:00
list (APPEND dbms_headers Functions/IFunction.h Functions/FunctionFactory.h Functions/FunctionHelpers.h Functions/extractTimeZoneFromFunctionArguments.h Functions/replicate.h Functions/FunctionsLogical.h)
list (APPEND dbms_sources
2021-06-06 21:49:55 +00:00
AggregateFunctions/IAggregateFunction.cpp
AggregateFunctions/AggregateFunctionFactory.cpp
AggregateFunctions/AggregateFunctionCombinatorFactory.cpp
AggregateFunctions/AggregateFunctionState.cpp
AggregateFunctions/AggregateFunctionCount.cpp
AggregateFunctions/parseAggregateFunctionParameters.cpp)
list (APPEND dbms_headers
AggregateFunctions/IAggregateFunction.h
AggregateFunctions/IAggregateFunctionCombinator.h
AggregateFunctions/AggregateFunctionFactory.h
AggregateFunctions/AggregateFunctionCombinatorFactory.h
AggregateFunctions/AggregateFunctionState.h
AggregateFunctions/AggregateFunctionCount.cpp
AggregateFunctions/FactoryHelpers.h
AggregateFunctions/parseAggregateFunctionParameters.h)
list (APPEND dbms_sources
TableFunctions/ITableFunction.cpp
TableFunctions/TableFunctionView.cpp
TableFunctions/TableFunctionFactory.cpp)
list (APPEND dbms_headers
TableFunctions/ITableFunction.h
TableFunctions/TableFunctionView.h
TableFunctions/TableFunctionFactory.h)
list (APPEND dbms_sources
Dictionaries/DictionaryFactory.cpp
Dictionaries/DictionarySourceFactory.cpp
Dictionaries/DictionaryStructure.cpp
Dictionaries/getDictionaryConfigurationFromAST.cpp)
list (APPEND dbms_headers
Dictionaries/DictionaryFactory.h
Dictionaries/DictionarySourceFactory.h
Dictionaries/DictionaryStructure.h
Dictionaries/getDictionaryConfigurationFromAST.h)
2019-09-15 10:35:12 +00:00
if (NOT ENABLE_SSL)
list (REMOVE_ITEM clickhouse_common_io_sources Common/OpenSSLHelpers.cpp)
list (REMOVE_ITEM clickhouse_common_io_headers Common/OpenSSLHelpers.h)
2019-09-15 10:35:12 +00:00
endif ()
add_library(clickhouse_common_io ${clickhouse_common_io_headers} ${clickhouse_common_io_sources})
2020-09-14 18:00:45 +00:00
if (SPLIT_SHARED_LIBRARIES)
target_compile_definitions(clickhouse_common_io PRIVATE SPLIT_SHARED_LIBRARIES)
endif ()
add_library (clickhouse_malloc OBJECT Common/malloc.cpp)
set_source_files_properties(Common/malloc.cpp PROPERTIES COMPILE_FLAGS "-fno-builtin")
2019-12-05 11:22:43 +00:00
if (((SANITIZE STREQUAL "thread") OR (SANITIZE STREQUAL "address")) AND COMPILER_GCC)
message(WARNING "Memory tracking is disabled, due to gcc sanitizers")
else()
add_library (clickhouse_new_delete STATIC Common/new_delete.cpp)
2022-01-18 06:51:13 +00:00
target_link_libraries (clickhouse_new_delete PRIVATE clickhouse_common_io)
if (TARGET ch_contrib::jemalloc)
target_link_libraries (clickhouse_new_delete PRIVATE ch_contrib::jemalloc)
endif()
endif()
2022-01-18 06:51:13 +00:00
if (TARGET ch_contrib::jemalloc)
target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::jemalloc)
endif()
add_subdirectory(Access/Common)
add_subdirectory(Common/ZooKeeper)
add_subdirectory(Common/Config)
set (all_modules)
macro(add_object_library name common_path)
if (USE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
2019-10-22 03:54:16 +00:00
add_headers_and_sources(dbms ${common_path})
else ()
2019-09-11 02:53:56 +00:00
list (APPEND all_modules ${name})
2019-10-22 03:54:16 +00:00
add_headers_and_sources(${name} ${common_path})
add_library(${name} SHARED ${${name}_sources} ${${name}_headers})
if (OS_DARWIN)
target_link_libraries (${name} PRIVATE -Wl,-undefined,dynamic_lookup)
else()
target_link_libraries (${name} PRIVATE -Wl,--unresolved-symbols=ignore-all)
endif()
endif ()
endmacro()
2022-06-01 15:47:43 +00:00
macro(remove_item_object_library name common_file)
if (USE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
list (REMOVE_ITEM dbms_sources ${common_file})
else ()
list (REMOVE_ITEM ${${name}_sources} ${common_file})
endif ()
endmacro()
add_object_library(clickhouse_access Access)
2021-08-18 22:19:14 +00:00
add_object_library(clickhouse_backups Backups)
add_object_library(clickhouse_core Core)
2020-08-13 05:02:16 +00:00
add_object_library(clickhouse_core_mysql Core/MySQL)
add_object_library(clickhouse_compression Compression)
2022-06-01 15:47:43 +00:00
if (NOT ENABLE_QPL_COMPRESSION)
remove_item_object_library(clickhouse_compression Compression/CompressionCodecDeflate.cpp)
else ()
set_source_files_properties(
Compression/CompressionCodecDeflate.cpp
PROPERTIES COMPILE_FLAGS "-mwaitpkg")
endif ()
2021-10-15 20:18:20 +00:00
add_object_library(clickhouse_querypipeline QueryPipeline)
add_object_library(clickhouse_datatypes DataTypes)
2021-03-09 14:46:52 +00:00
add_object_library(clickhouse_datatypes_serializations DataTypes/Serializations)
add_object_library(clickhouse_databases Databases)
add_object_library(clickhouse_databases_mysql Databases/MySQL)
add_object_library(clickhouse_disks Disks)
add_object_library(clickhouse_interpreters Interpreters)
add_object_library(clickhouse_interpreters_access Interpreters/Access)
add_object_library(clickhouse_interpreters_mysql Interpreters/MySQL)
add_object_library(clickhouse_interpreters_clusterproxy Interpreters/ClusterProxy)
2021-04-29 11:15:35 +00:00
add_object_library(clickhouse_interpreters_jit Interpreters/JIT)
add_object_library(clickhouse_columns Columns)
add_object_library(clickhouse_storages Storages)
add_object_library(clickhouse_storages_mysql Storages/MySQL)
add_object_library(clickhouse_storages_distributed Storages/Distributed)
add_object_library(clickhouse_storages_mergetree Storages/MergeTree)
add_object_library(clickhouse_storages_liveview Storages/LiveView)
2020-04-02 17:14:34 +00:00
add_object_library(clickhouse_storages_windowview Storages/WindowView)
add_object_library(clickhouse_client Client)
2022-04-27 15:05:45 +00:00
add_object_library(clickhouse_bridge BridgeHelper)
add_object_library(clickhouse_server Server)
add_object_library(clickhouse_server_http Server/HTTP)
add_object_library(clickhouse_formats Formats)
add_object_library(clickhouse_processors Processors)
add_object_library(clickhouse_processors_executors Processors/Executors)
add_object_library(clickhouse_processors_formats Processors/Formats)
add_object_library(clickhouse_processors_formats_impl Processors/Formats/Impl)
add_object_library(clickhouse_processors_transforms Processors/Transforms)
add_object_library(clickhouse_processors_sources Processors/Sources)
add_object_library(clickhouse_processors_sinks Processors/Sinks)
2020-04-12 14:17:34 +00:00
add_object_library(clickhouse_processors_merges Processors/Merges)
2021-10-15 10:11:57 +00:00
add_object_library(clickhouse_processors_ttl Processors/TTL)
2020-04-14 09:21:24 +00:00
add_object_library(clickhouse_processors_merges_algorithms Processors/Merges/Algorithms)
2020-06-05 15:38:03 +00:00
add_object_library(clickhouse_processors_queryplan Processors/QueryPlan)
add_object_library(clickhouse_processors_queryplan_optimizations Processors/QueryPlan/Optimizations)
2022-01-17 18:45:54 +00:00
if (TARGET ch_contrib::nuraft)
2021-02-01 13:18:17 +00:00
add_object_library(clickhouse_coordination Coordination)
endif()
if (USE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
2019-09-11 02:53:56 +00:00
add_library (dbms STATIC ${dbms_headers} ${dbms_sources})
target_link_libraries (dbms PRIVATE ch_contrib::libdivide)
2022-01-18 06:51:13 +00:00
if (TARGET ch_contrib::jemalloc)
target_link_libraries (dbms PRIVATE ch_contrib::jemalloc)
endif()
2019-09-11 02:53:56 +00:00
set (all_modules dbms)
else()
2019-09-11 02:53:56 +00:00
add_library (dbms SHARED ${dbms_headers} ${dbms_sources})
target_link_libraries (dbms PUBLIC ${all_modules})
target_link_libraries (clickhouse_interpreters PRIVATE ch_contrib::libdivide)
2022-01-18 06:51:13 +00:00
if (TARGET ch_contrib::jemalloc)
target_link_libraries (clickhouse_interpreters PRIVATE ch_contrib::jemalloc)
endif()
2019-09-11 02:53:56 +00:00
list (APPEND all_modules dbms)
# force all split libs to be linked
if (OS_DARWIN)
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,error")
else()
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
endif()
endif ()
macro (dbms_target_include_directories)
foreach (module ${all_modules})
target_include_directories (${module} ${ARGN})
endforeach ()
endmacro ()
macro (dbms_target_link_libraries)
foreach (module ${all_modules})
target_link_libraries (${module} ${ARGN})
endforeach ()
endmacro ()
dbms_target_include_directories (PUBLIC "${ClickHouse_SOURCE_DIR}/src" "${ClickHouse_BINARY_DIR}/src")
target_include_directories (clickhouse_common_io PUBLIC "${ClickHouse_SOURCE_DIR}/src" "${ClickHouse_BINARY_DIR}/src")
2022-01-18 06:48:23 +00:00
if (TARGET ch_contrib::llvm)
dbms_target_link_libraries (PUBLIC ch_contrib::llvm)
endif ()
2019-08-03 15:43:37 +00:00
# Otherwise it will slow down stack traces printing too much.
set_source_files_properties(
Common/Elf.cpp
Common/Dwarf.cpp
Common/SymbolIndex.cpp
2019-08-03 15:43:37 +00:00
PROPERTIES COMPILE_FLAGS "-O3 ${WITHOUT_COVERAGE}")
2017-11-21 19:17:24 +00:00
target_link_libraries (clickhouse_common_io
PRIVATE
string_utils
widechar_width
${LINK_LIBRARIES_ONLY_ON_X86_64}
PUBLIC
common
ch_contrib::double_conversion
ch_contrib::dragonbox_to_chars
2019-05-15 17:19:39 +00:00
)
2021-10-13 02:04:21 +00:00
# Use X86 AVX2/AVX512 instructions to accelerate filter operations
set_source_files_properties(
Columns/ColumnFixedString.cpp
Columns/ColumnsCommon.cpp
Columns/ColumnVector.cpp
Columns/ColumnDecimal.cpp
Columns/ColumnString.cpp
2021-10-13 02:04:21 +00:00
PROPERTIES COMPILE_FLAGS "${X86_INTRINSICS_FLAGS}")
target_link_libraries(clickhouse_common_io PUBLIC ch_contrib::re2_st)
target_link_libraries(clickhouse_common_io PUBLIC ch_contrib::re2)
2019-05-15 17:19:39 +00:00
target_link_libraries(clickhouse_common_io
PRIVATE
${EXECINFO_LIBRARIES}
PUBLIC
boost::program_options
boost::system
2022-01-17 19:09:12 +00:00
ch_contrib::cityhash
2022-01-16 10:34:54 +00:00
ch_contrib::zlib
pcg_random
Poco::Foundation
)
2022-01-18 06:51:13 +00:00
if (TARGET ch_contrib::cpuid)
target_link_libraries(clickhouse_common_io PRIVATE ch_contrib::cpuid)
endif()
2022-01-22 19:41:41 +00:00
dbms_target_link_libraries(PUBLIC ch_contrib::abseil_swiss_tables)
2022-01-21 16:40:24 +00:00
# Make dbms depend on roaring instead of clickhouse_common_io so that roaring itself can depend on clickhouse_common_io
# That way we we can redirect malloc/free functions avoiding circular dependencies
dbms_target_link_libraries(PUBLIC ch_contrib::roaring)
if (TARGET ch_contrib::rdkafka)
dbms_target_link_libraries(PRIVATE ch_contrib::rdkafka ch_contrib::cppkafka)
2020-07-16 20:32:32 +00:00
endif()
2022-01-17 21:54:24 +00:00
if (TARGET ch_contrib::sasl2)
dbms_target_link_libraries(PRIVATE ch_contrib::sasl2)
2020-07-16 20:32:32 +00:00
endif()
2022-01-17 21:44:15 +00:00
if (TARGET ch_contrib::krb5)
dbms_target_link_libraries(PRIVATE ch_contrib::krb5)
2020-12-24 20:10:47 +00:00
endif()
2020-09-02 09:13:59 +00:00
2022-01-17 18:45:54 +00:00
if (TARGET ch_contrib::nuraft)
dbms_target_link_libraries(PUBLIC ch_contrib::nuraft)
2019-05-15 17:19:39 +00:00
endif()
2019-01-31 16:48:37 +00:00
dbms_target_link_libraries (
PRIVATE
boost::filesystem
boost::program_options
clickhouse_common_config
clickhouse_common_zookeeper
clickhouse_dictionaries_embedded
clickhouse_parsers
2022-01-17 05:28:05 +00:00
ch_contrib::lz4
Poco::JSON
2020-05-26 10:19:59 +00:00
Poco::MongoDB
string_utils
PUBLIC
boost::system
clickhouse_common_io
)
2022-01-18 06:48:23 +00:00
if (TARGET ch::mysqlxx)
dbms_target_link_libraries (PUBLIC ch::mysqlxx)
endif()
2021-11-21 10:58:26 +00:00
dbms_target_link_libraries (
PUBLIC
boost::circular_buffer
boost::heap)
2021-09-06 15:58:08 +00:00
target_include_directories(clickhouse_common_io PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/Core/include") # uses some includes from core
dbms_target_include_directories(PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/Core/include")
2022-01-17 21:37:14 +00:00
target_link_libraries(clickhouse_common_io PUBLIC
ch_contrib::miniselect
ch_contrib::pdqsort)
dbms_target_link_libraries(PUBLIC
ch_contrib::miniselect
ch_contrib::pdqsort)
2022-01-16 09:20:20 +00:00
dbms_target_link_libraries(PRIVATE ch_contrib::zstd)
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::zstd)
2022-01-18 07:18:46 +00:00
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::xz)
2022-01-17 19:20:39 +00:00
if (TARGET ch_contrib::icu)
dbms_target_link_libraries (PRIVATE ch_contrib::icu)
2017-04-23 19:17:51 +00:00
endif ()
2022-01-17 20:57:21 +00:00
if (TARGET ch_contrib::capnp)
dbms_target_link_libraries (PRIVATE ch_contrib::capnp)
endif ()
2022-01-16 18:02:32 +00:00
if (TARGET ch_contrib::parquet)
dbms_target_link_libraries (PRIVATE ch_contrib::parquet)
endif ()
2018-05-05 16:21:59 +00:00
2022-01-16 19:34:00 +00:00
if (TARGET ch_contrib::avrocpp)
dbms_target_link_libraries(PRIVATE ch_contrib::avrocpp)
endif ()
if (TARGET OpenSSL::Crypto)
dbms_target_link_libraries (PRIVATE OpenSSL::Crypto)
target_link_libraries (clickhouse_common_io PRIVATE OpenSSL::Crypto)
endif ()
2022-01-17 06:00:50 +00:00
if (TARGET ch_contrib::ldap)
dbms_target_link_libraries (PRIVATE ch_contrib::ldap ch_contrib::lber)
endif ()
2022-01-17 19:04:55 +00:00
dbms_target_link_libraries (PRIVATE ch_contrib::sparsehash)
2022-01-17 07:46:31 +00:00
if (TARGET ch_contrib::protobuf)
dbms_target_link_libraries (PRIVATE ch_contrib::protobuf)
endif ()
2022-01-17 07:36:58 +00:00
if (TARGET clickhouse_grpc_protos)
2020-10-11 02:19:01 +00:00
dbms_target_link_libraries (PUBLIC clickhouse_grpc_protos)
endif()
2022-01-17 18:45:53 +00:00
if (TARGET ch_contrib::hdfs)
dbms_target_link_libraries(PRIVATE ch_contrib::hdfs)
endif()
2022-01-17 05:06:53 +00:00
if (TARGET ch_contrib::hivemetastore)
dbms_target_link_libraries(PRIVATE ch_contrib::hivemetastore)
2019-12-03 16:23:24 +00:00
endif()
2021-11-22 02:52:10 +00:00
2022-01-18 06:48:23 +00:00
if (TARGET ch_contrib::aws_s3)
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::aws_s3)
endif()
if (TARGET ch_contrib::azure_sdk)
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::azure_sdk)
2021-07-06 11:34:33 +00:00
endif()
2022-01-17 05:53:49 +00:00
if (TARGET ch_contrib::s2)
dbms_target_link_libraries (PUBLIC ch_contrib::s2)
2019-02-02 13:33:50 +00:00
endif()
2022-01-17 18:48:14 +00:00
if (TARGET ch_contrib::brotli)
target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::brotli)
2021-04-09 12:47:26 +00:00
endif()
2022-01-16 20:00:25 +00:00
if (TARGET ch_contrib::snappy)
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::snappy)
2021-11-05 11:55:30 +00:00
endif()
2022-01-17 19:53:36 +00:00
if (TARGET ch_contrib::amqp_cpp)
dbms_target_link_libraries(PUBLIC ch_contrib::amqp_cpp)
2021-04-09 12:47:26 +00:00
endif()
2022-01-17 20:53:49 +00:00
if (TARGET ch_contrib::sqlite)
dbms_target_link_libraries(PUBLIC ch_contrib::sqlite)
2021-07-09 14:22:53 +00:00
endif()
2022-01-17 20:21:37 +00:00
if (TARGET ch_contrib::msgpack)
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::msgpack)
2020-07-10 18:27:10 +00:00
endif()
2020-04-04 14:02:14 +00:00
2022-01-17 21:20:47 +00:00
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::fast_float)
2020-11-07 16:48:58 +00:00
if (USE_ORC)
dbms_target_link_libraries(PUBLIC ${ORC_LIBRARIES})
dbms_target_include_directories(SYSTEM BEFORE PUBLIC ${ORC_INCLUDE_DIR} "${CMAKE_BINARY_DIR}/contrib/orc/c++/include")
endif ()
2022-01-16 10:44:23 +00:00
if (TARGET ch_contrib::rocksdb)
dbms_target_link_libraries(PUBLIC ch_contrib::rocksdb)
2020-09-02 09:13:59 +00:00
endif()
2022-01-17 21:29:27 +00:00
if (TARGET ch_contrib::libpqxx)
dbms_target_link_libraries(PUBLIC ch_contrib::libpqxx)
2020-12-10 00:36:31 +00:00
endif()
2022-01-17 22:13:47 +00:00
if (TARGET ch_contrib::datasketches)
target_link_libraries (clickhouse_aggregate_functions PRIVATE ch_contrib::datasketches)
2021-02-25 16:44:01 +00:00
endif ()
2022-01-17 05:28:05 +00:00
target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::lz4)
2022-06-01 15:47:43 +00:00
if (ENABLE_QPL_COMPRESSION)
dbms_target_link_libraries(PUBLIC ch_contrib::qpl)
dbms_target_include_directories(SYSTEM BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/qpl/include)
endif ()
2021-06-17 08:31:37 +00:00
2020-12-04 12:43:05 +00:00
dbms_target_link_libraries(PRIVATE _boost_context)
2022-01-18 06:48:23 +00:00
if (ENABLE_NLP)
dbms_target_link_libraries (PUBLIC ch_contrib::stemmer)
dbms_target_link_libraries (PUBLIC ch_contrib::wnb)
dbms_target_link_libraries (PUBLIC ch_contrib::lemmagen)
dbms_target_link_libraries (PUBLIC ch_contrib::nlp_data)
endif()
2022-01-16 10:55:08 +00:00
if (TARGET ch_contrib::bzip2)
target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::bzip2)
2021-08-06 23:55:04 +00:00
endif()
2022-01-28 17:31:50 +00:00
if (TARGET ch_contrib::minizip)
target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::minizip)
endif ()
2022-01-17 19:29:50 +00:00
if (TARGET ch_contrib::simdjson)
dbms_target_link_libraries(PRIVATE ch_contrib::simdjson)
endif()
2022-01-17 19:37:33 +00:00
if (TARGET ch_contrib::rapidjson)
dbms_target_link_libraries(PRIVATE ch_contrib::rapidjson)
endif()
dbms_target_link_libraries(PUBLIC ch_contrib::consistent_hashing)
include ("${ClickHouse_SOURCE_DIR}/cmake/add_check.cmake")
2021-03-03 23:11:27 +00:00
if (ENABLE_TESTS)
macro (grep_gtest_sources BASE_DIR DST_VAR)
# Cold match files that are not in tests/ directories
file(GLOB_RECURSE "${DST_VAR}" CONFIGURE_DEPENDS RELATIVE "${BASE_DIR}" "gtest*.cpp")
endmacro()
# attach all dbms gtest sources
grep_gtest_sources("${ClickHouse_SOURCE_DIR}/src" dbms_gtest_sources)
add_executable(unit_tests_dbms ${dbms_gtest_sources})
2019-07-08 01:58:15 +00:00
# gtest framework has substandard code
target_compile_options(unit_tests_dbms PRIVATE
-Wno-zero-as-null-pointer-constant
-Wno-covered-switch-default
-Wno-undef
-Wno-sign-compare
-Wno-used-but-marked-unused
-Wno-missing-noreturn
-Wno-gnu-zero-variadic-macro-arguments
)
2019-07-08 01:58:15 +00:00
2021-03-03 22:34:30 +00:00
target_link_libraries(unit_tests_dbms PRIVATE
ch_contrib::gtest_all
2021-03-03 22:34:30 +00:00
clickhouse_functions
clickhouse_aggregate_functions
clickhouse_parsers
clickhouse_storages_system
dbms
clickhouse_common_config
2021-03-03 22:34:30 +00:00
clickhouse_common_zookeeper
string_utils)
if (TARGET ch_contrib::simdjson)
target_link_libraries(unit_tests_dbms PRIVATE ch_contrib::simdjson)
2021-04-23 12:53:38 +00:00
endif()
if (TARGET ch_contrib::yaml_cpp)
target_link_libraries(unit_tests_dbms PRIVATE ch_contrib::yaml_cpp)
2021-04-23 12:53:38 +00:00
endif()
add_check(unit_tests_dbms)
endif ()
2021-05-23 16:39:40 +00:00