cloudflare/ClickHouse
Publicmirrored fromhttps://github.com/cloudflare/ClickHouse
dbms/CMakeLists.txt
377lines · modecode
unknown
| 1 | if (USE_INCLUDE_WHAT_YOU_USE) |
| 2 | set (CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_PATH}) |
| 3 | endif () |
| 4 | |
| 5 | if(COMPILER_PIPE) |
| 6 | set(MAX_COMPILER_MEMORY 2500) |
| 7 | else() |
| 8 | set(MAX_COMPILER_MEMORY 1500) |
| 9 | endif() |
| 10 | if(MAKE_STATIC_LIBRARIES) |
| 11 | set(MAX_LINKER_MEMORY 3500) |
| 12 | else() |
| 13 | set(MAX_LINKER_MEMORY 2500) |
| 14 | endif() |
| 15 | include(../cmake/limit_jobs.cmake) |
| 16 | |
| 17 | include(cmake/find_vectorclass.cmake) |
| 18 | |
| 19 | set (CONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/src/Common/config_version.h) |
| 20 | set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/src/Common/config.h) |
| 21 | |
| 22 | include (cmake/version.cmake) |
| 23 | message (STATUS "Will build ${VERSION_FULL} revision ${VERSION_REVISION} ${VERSION_OFFICIAL}") |
| 24 | configure_file (src/Common/config.h.in ${CONFIG_COMMON}) |
| 25 | configure_file (src/Common/config_version.h.in ${CONFIG_VERSION}) |
| 26 | configure_file (src/Core/config_core.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/Core/include/config_core.h) |
| 27 | |
| 28 | if (NOT MSVC) |
| 29 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") |
| 30 | endif () |
| 31 | |
| 32 | if (NOT NO_WERROR) |
| 33 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") |
| 34 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") |
| 35 | endif () |
| 36 | |
| 37 | # Add some warnings that are not available even with -Wall -Wextra -Wpedantic. |
| 38 | |
| 39 | option (WEVERYTHING "Enables -Weverything option with some exceptions. This is intended for exploration of new compiler warnings that may be found to be useful. Only makes sense for clang." ON) |
| 40 | |
| 41 | if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
| 42 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Wno-vla-extension -Wno-zero-length-array -Wno-gnu-anonymous-struct -Wno-nested-anon-types") |
| 43 | |
| 44 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow -Wshadow-uncaptured-local -Wextra-semi -Wcomma -Winconsistent-missing-destructor-override -Wunused-exception-parameter -Wcovered-switch-default -Wold-style-cast -Wrange-loop-analysis -Wunused-member-function -Wunreachable-code -Wunreachable-code-return -Wnewline-eof -Wembedded-directive -Wgnu-case-range -Wunused-macros -Wconditional-uninitialized -Wdeprecated -Wundef -Wreserved-id-macro -Wredundant-parens -Wzero-as-null-pointer-constant") |
| 45 | |
| 46 | if (WEVERYTHING) |
| 47 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-missing-noreturn -Wno-padded -Wno-switch-enum -Wno-shadow-field-in-constructor -Wno-deprecated-dynamic-exception-spec -Wno-float-equal -Wno-weak-vtables -Wno-shift-sign-overflow -Wno-sign-conversion -Wno-conversion -Wno-exit-time-destructors -Wno-undefined-func-template -Wno-documentation-unknown-command -Wno-missing-variable-declarations -Wno-unused-template -Wno-global-constructors -Wno-c99-extensions -Wno-missing-prototypes -Wno-weak-template-vtables -Wno-zero-length-array -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-disabled-macro-expansion -Wno-used-but-marked-unused -Wno-vla-extension -Wno-vla -Wno-packed") |
| 48 | |
| 49 | # TODO Enable conversion, sign-conversion, double-promotion warnings. |
| 50 | endif () |
| 51 | |
| 52 | if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7) |
| 53 | if (WEVERYTHING) |
| 54 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-std-move-in-c++11") |
| 55 | endif () |
| 56 | endif () |
| 57 | |
| 58 | if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8) |
| 59 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow-field -Wstring-plus-int") |
| 60 | if(NOT APPLE) |
| 61 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra-semi-stmt -Wempty-init-stmt") |
| 62 | endif() |
| 63 | endif () |
| 64 | |
| 65 | if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) |
| 66 | if (WEVERYTHING AND NOT APPLE) |
| 67 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-ctad-maybe-unsupported") |
| 68 | endif () |
| 69 | endif () |
| 70 | endif () |
| 71 | |
| 72 | if (USE_DEBUG_HELPERS) |
| 73 | set (INCLUDE_DEBUG_HELPERS "-include ${ClickHouse_SOURCE_DIR}/libs/libcommon/include/common/iostream_debug_helpers.h") |
| 74 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${INCLUDE_DEBUG_HELPERS}") |
| 75 | endif () |
| 76 | |
| 77 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
| 78 | # If we leave this optimization enabled, gcc-7 replaces a pair of SSE intrinsics (16 byte load, store) with a call to memcpy. |
| 79 | # It leads to slow code. This is compiler bug. It looks like this: |
| 80 | # |
| 81 | # (gdb) bt |
| 82 | #0 memcpy (destination=0x7faa6e9f1638, source=0x7faa81d9e9a8, size=16) at ../libs/libmemcpy/memcpy.h:11 |
| 83 | #1 0x0000000005341c5f in _mm_storeu_si128 (__B=..., __P=<optimized out>) at /usr/lib/gcc/x86_64-linux-gnu/7/include/emmintrin.h:720 |
| 84 | #2 memcpySmallAllowReadWriteOverflow15Impl (n=<optimized out>, src=<optimized out>, dst=<optimized out>) at ../dbms/src/Common/memcpySmall.h:37 |
| 85 | |
| 86 | add_definitions ("-fno-tree-loop-distribute-patterns") |
| 87 | endif () |
| 88 | |
| 89 | add_subdirectory (src) |
| 90 | |
| 91 | set(dbms_headers) |
| 92 | set(dbms_sources) |
| 93 | |
| 94 | include(../cmake/dbms_glob_sources.cmake) |
| 95 | |
| 96 | add_headers_and_sources(clickhouse_common_io src/Common) |
| 97 | add_headers_and_sources(clickhouse_common_io src/Common/HashTable) |
| 98 | add_headers_and_sources(clickhouse_common_io src/IO) |
| 99 | |
| 100 | add_headers_and_sources(dbms src/Core) |
| 101 | add_headers_and_sources(dbms src/DataStreams) |
| 102 | add_headers_and_sources(dbms src/DataTypes) |
| 103 | add_headers_and_sources(dbms src/Databases) |
| 104 | add_headers_and_sources(dbms src/Interpreters) |
| 105 | add_headers_and_sources(dbms src/Interpreters/ClusterProxy) |
| 106 | add_headers_and_sources(dbms src/Columns) |
| 107 | add_headers_and_sources(dbms src/Storages) |
| 108 | add_headers_and_sources(dbms src/Storages/Distributed) |
| 109 | add_headers_and_sources(dbms src/Storages/MergeTree) |
| 110 | add_headers_and_sources(dbms src/Client) |
| 111 | add_headers_and_sources(dbms src/Formats) |
| 112 | |
| 113 | list (APPEND clickhouse_common_io_sources ${CONFIG_BUILD}) |
| 114 | list (APPEND clickhouse_common_io_headers ${CONFIG_VERSION} ${CONFIG_COMMON}) |
| 115 | |
| 116 | list (APPEND dbms_sources src/Functions/IFunction.cpp src/Functions/FunctionFactory.cpp src/Functions/FunctionHelpers.cpp) |
| 117 | list (APPEND dbms_headers src/Functions/IFunction.h src/Functions/FunctionFactory.h src/Functions/FunctionHelpers.h) |
| 118 | |
| 119 | list (APPEND dbms_sources |
| 120 | src/AggregateFunctions/AggregateFunctionFactory.cpp |
| 121 | src/AggregateFunctions/AggregateFunctionCombinatorFactory.cpp |
| 122 | src/AggregateFunctions/AggregateFunctionState.cpp |
| 123 | src/AggregateFunctions/parseAggregateFunctionParameters.cpp) |
| 124 | |
| 125 | list (APPEND dbms_headers |
| 126 | src/AggregateFunctions/IAggregateFunction.h |
| 127 | src/AggregateFunctions/IAggregateFunctionCombinator.h |
| 128 | src/AggregateFunctions/AggregateFunctionFactory.h |
| 129 | src/AggregateFunctions/AggregateFunctionCombinatorFactory.h |
| 130 | src/AggregateFunctions/AggregateFunctionState.h |
| 131 | src/AggregateFunctions/FactoryHelpers.h |
| 132 | src/AggregateFunctions/parseAggregateFunctionParameters.h) |
| 133 | |
| 134 | list (APPEND dbms_sources src/TableFunctions/ITableFunction.cpp src/TableFunctions/TableFunctionFactory.cpp) |
| 135 | list (APPEND dbms_headers src/TableFunctions/ITableFunction.h src/TableFunctions/TableFunctionFactory.h) |
| 136 | list (APPEND dbms_sources src/Dictionaries/DictionaryFactory.cpp src/Dictionaries/DictionarySourceFactory.cpp src/Dictionaries/DictionaryStructure.cpp) |
| 137 | list (APPEND dbms_headers src/Dictionaries/DictionaryFactory.h src/Dictionaries/DictionarySourceFactory.h src/Dictionaries/DictionaryStructure.h) |
| 138 | |
| 139 | add_library(clickhouse_common_io ${clickhouse_common_io_headers} ${clickhouse_common_io_sources}) |
| 140 | |
| 141 | if (OS_FREEBSD) |
| 142 | target_compile_definitions (clickhouse_common_io PUBLIC CLOCK_MONOTONIC_COARSE=CLOCK_MONOTONIC_FAST) |
| 143 | endif () |
| 144 | |
| 145 | add_subdirectory(src/Common/ZooKeeper) |
| 146 | add_subdirectory(src/Common/Config) |
| 147 | |
| 148 | if (MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES) |
| 149 | add_library(dbms ${dbms_headers} ${dbms_sources}) |
| 150 | else () |
| 151 | add_library(dbms SHARED ${dbms_headers} ${dbms_sources}) |
| 152 | endif () |
| 153 | |
| 154 | if (USE_EMBEDDED_COMPILER) |
| 155 | llvm_libs_all(REQUIRED_LLVM_LIBRARIES) |
| 156 | target_link_libraries (dbms PRIVATE ${REQUIRED_LLVM_LIBRARIES}) |
| 157 | target_include_directories (dbms SYSTEM BEFORE PUBLIC ${LLVM_INCLUDE_DIRS}) |
| 158 | endif () |
| 159 | |
| 160 | if (CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE" OR CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO" OR CMAKE_BUILD_TYPE_UC STREQUAL "MINSIZEREL") |
| 161 | # Won't generate debug info for files with heavy template instantiation to achieve faster linking and lower size. |
| 162 | set_source_files_properties( |
| 163 | src/Dictionaries/FlatDictionary.cpp |
| 164 | src/Dictionaries/HashedDictionary.cpp |
| 165 | src/Dictionaries/CacheDictionary.cpp |
| 166 | src/Dictionaries/TrieDictionary.cpp |
| 167 | src/Dictionaries/RangeHashedDictionary.cpp |
| 168 | src/Dictionaries/ComplexKeyHashedDictionary.cpp |
| 169 | src/Dictionaries/ComplexKeyCacheDictionary.cpp |
| 170 | src/Dictionaries/ComplexKeyCacheDictionary_generate1.cpp |
| 171 | src/Dictionaries/ComplexKeyCacheDictionary_generate2.cpp |
| 172 | src/Dictionaries/ComplexKeyCacheDictionary_generate3.cpp |
| 173 | src/Dictionaries/ODBCBlockInputStream.cpp |
| 174 | src/Dictionaries/HTTPDictionarySource.cpp |
| 175 | src/Dictionaries/LibraryDictionarySource.cpp |
| 176 | src/Dictionaries/ExecutableDictionarySource.cpp |
| 177 | src/Dictionaries/ClickHouseDictionarySource.cpp |
| 178 | PROPERTIES COMPILE_FLAGS -g0) |
| 179 | endif () |
| 180 | |
| 181 | target_link_libraries (clickhouse_common_io |
| 182 | PUBLIC |
| 183 | common |
| 184 | PRIVATE |
| 185 | string_utils |
| 186 | widechar_width |
| 187 | ${LINK_LIBRARIES_ONLY_ON_X86_64} |
| 188 | PUBLIC |
| 189 | ${DOUBLE_CONVERSION_LIBRARIES} |
| 190 | PUBLIC |
| 191 | ${Poco_Net_LIBRARY} |
| 192 | ${Poco_Util_LIBRARY} |
| 193 | ${Poco_Foundation_LIBRARY} |
| 194 | ) |
| 195 | |
| 196 | if(RE2_LIBRARY) |
| 197 | target_link_libraries(clickhouse_common_io PUBLIC ${RE2_LIBRARY}) |
| 198 | endif() |
| 199 | if(RE2_ST_LIBRARY) |
| 200 | target_link_libraries(clickhouse_common_io PUBLIC ${RE2_ST_LIBRARY}) |
| 201 | endif() |
| 202 | |
| 203 | target_link_libraries(clickhouse_common_io |
| 204 | PUBLIC |
| 205 | ${CITYHASH_LIBRARIES} |
| 206 | PRIVATE |
| 207 | ${ZLIB_LIBRARIES} |
| 208 | ${EXECINFO_LIBRARIES} |
| 209 | PUBLIC |
| 210 | ${Boost_SYSTEM_LIBRARY} |
| 211 | PRIVATE |
| 212 | apple_rt |
| 213 | PUBLIC |
| 214 | Threads::Threads |
| 215 | PRIVATE |
| 216 | ${CMAKE_DL_LIBS} |
| 217 | PUBLIC |
| 218 | roaring |
| 219 | ) |
| 220 | |
| 221 | |
| 222 | if(RE2_INCLUDE_DIR) |
| 223 | target_include_directories(clickhouse_common_io SYSTEM BEFORE PUBLIC ${RE2_INCLUDE_DIR}) |
| 224 | endif() |
| 225 | |
| 226 | if (USE_MIMALLOC) |
| 227 | target_include_directories (clickhouse_common_io SYSTEM BEFORE PUBLIC ${MIMALLOC_INCLUDE_DIR}) |
| 228 | target_link_libraries (clickhouse_common_io PRIVATE ${MIMALLOC_LIBRARY}) |
| 229 | endif () |
| 230 | |
| 231 | if(CPUID_LIBRARY) |
| 232 | target_link_libraries(clickhouse_common_io PRIVATE ${CPUID_LIBRARY}) |
| 233 | endif() |
| 234 | |
| 235 | if(CPUINFO_LIBRARY) |
| 236 | target_link_libraries(clickhouse_common_io PRIVATE ${CPUINFO_LIBRARY}) |
| 237 | endif() |
| 238 | |
| 239 | target_link_libraries (dbms |
| 240 | PUBLIC |
| 241 | clickhouse_compression |
| 242 | PRIVATE |
| 243 | clickhouse_parsers |
| 244 | clickhouse_common_config |
| 245 | PUBLIC |
| 246 | clickhouse_common_io |
| 247 | PRIVATE |
| 248 | clickhouse_dictionaries_embedded |
| 249 | PUBLIC |
| 250 | ${MYSQLXX_LIBRARY} |
| 251 | PRIVATE |
| 252 | ${BTRIE_LIBRARIES} |
| 253 | ${Boost_PROGRAM_OPTIONS_LIBRARY} |
| 254 | PUBLIC |
| 255 | ${Boost_SYSTEM_LIBRARY} |
| 256 | Threads::Threads |
| 257 | ) |
| 258 | |
| 259 | target_include_directories(dbms PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/src/Core/include) |
| 260 | target_include_directories(clickhouse_common_io PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/src/Core/include) # uses some includes from core |
| 261 | target_include_directories(dbms SYSTEM BEFORE PUBLIC ${PDQSORT_INCLUDE_DIR}) |
| 262 | |
| 263 | if (NOT USE_INTERNAL_BOOST_LIBRARY) |
| 264 | target_include_directories (clickhouse_common_io SYSTEM BEFORE PUBLIC ${Boost_INCLUDE_DIRS}) |
| 265 | endif () |
| 266 | |
| 267 | if (Poco_SQL_FOUND AND NOT USE_INTERNAL_POCO_LIBRARY) |
| 268 | target_include_directories (clickhouse_common_io SYSTEM PRIVATE ${Poco_SQL_INCLUDE_DIR}) |
| 269 | target_include_directories (dbms SYSTEM PRIVATE ${Poco_SQL_INCLUDE_DIR}) |
| 270 | endif() |
| 271 | |
| 272 | if (USE_POCO_SQLODBC) |
| 273 | target_link_libraries (clickhouse_common_io PRIVATE ${Poco_SQL_LIBRARY}) |
| 274 | target_link_libraries (dbms PRIVATE ${Poco_SQLODBC_LIBRARY} ${Poco_SQL_LIBRARY}) |
| 275 | if (NOT USE_INTERNAL_POCO_LIBRARY) |
| 276 | target_include_directories (clickhouse_common_io SYSTEM PRIVATE ${ODBC_INCLUDE_DIRS} ${Poco_SQL_INCLUDE_DIR}) |
| 277 | target_include_directories (dbms SYSTEM PRIVATE ${ODBC_INCLUDE_DIRS} ${Poco_SQLODBC_INCLUDE_DIR} SYSTEM PUBLIC ${Poco_SQL_INCLUDE_DIR}) |
| 278 | endif() |
| 279 | endif() |
| 280 | |
| 281 | if (Poco_Data_FOUND) |
| 282 | target_include_directories (clickhouse_common_io SYSTEM PRIVATE ${Poco_Data_INCLUDE_DIR}) |
| 283 | target_include_directories (dbms SYSTEM PRIVATE ${Poco_Data_INCLUDE_DIR}) |
| 284 | endif() |
| 285 | |
| 286 | if (USE_POCO_DATAODBC) |
| 287 | target_link_libraries (clickhouse_common_io PRIVATE ${Poco_Data_LIBRARY}) |
| 288 | target_link_libraries (dbms PRIVATE ${Poco_DataODBC_LIBRARY}) |
| 289 | if (NOT USE_INTERNAL_POCO_LIBRARY) |
| 290 | target_include_directories (dbms SYSTEM PRIVATE ${ODBC_INCLUDE_DIRS} ${Poco_DataODBC_INCLUDE_DIR}) |
| 291 | endif() |
| 292 | endif() |
| 293 | |
| 294 | if (USE_POCO_MONGODB) |
| 295 | target_link_libraries (dbms PRIVATE ${Poco_MongoDB_LIBRARY}) |
| 296 | endif() |
| 297 | |
| 298 | if (USE_POCO_NETSSL) |
| 299 | target_link_libraries (clickhouse_common_io PRIVATE ${Poco_NetSSL_LIBRARY} ${Poco_Crypto_LIBRARY}) |
| 300 | target_link_libraries (dbms PRIVATE ${Poco_NetSSL_LIBRARY} ${Poco_Crypto_LIBRARY}) |
| 301 | endif() |
| 302 | |
| 303 | target_link_libraries (dbms PRIVATE ${Poco_Foundation_LIBRARY}) |
| 304 | |
| 305 | if (USE_ICU) |
| 306 | target_link_libraries (dbms PRIVATE ${ICU_LIBRARIES}) |
| 307 | target_include_directories (dbms SYSTEM PRIVATE ${ICU_INCLUDE_DIRS}) |
| 308 | endif () |
| 309 | |
| 310 | if (USE_CAPNP) |
| 311 | target_link_libraries (dbms PRIVATE ${CAPNP_LIBRARY}) |
| 312 | if (NOT USE_INTERNAL_CAPNP_LIBRARY) |
| 313 | target_include_directories (dbms SYSTEM BEFORE PRIVATE ${CAPNP_INCLUDE_DIR}) |
| 314 | endif () |
| 315 | endif () |
| 316 | |
| 317 | if (USE_RDKAFKA) |
| 318 | target_link_libraries (dbms PRIVATE clickhouse_storage_kafka) |
| 319 | endif () |
| 320 | |
| 321 | if (USE_PARQUET) |
| 322 | target_link_libraries(dbms PRIVATE ${PARQUET_LIBRARY}) |
| 323 | if (NOT USE_INTERNAL_PARQUET_LIBRARY OR USE_INTERNAL_PARQUET_LIBRARY_NATIVE_CMAKE) |
| 324 | target_include_directories (dbms SYSTEM BEFORE PRIVATE ${PARQUET_INCLUDE_DIR} ${ARROW_INCLUDE_DIR}) |
| 325 | endif () |
| 326 | endif () |
| 327 | |
| 328 | if(OPENSSL_CRYPTO_LIBRARY) |
| 329 | target_link_libraries(dbms PRIVATE ${OPENSSL_CRYPTO_LIBRARY}) |
| 330 | endif () |
| 331 | target_link_libraries(dbms PRIVATE Threads::Threads) |
| 332 | |
| 333 | target_include_directories (dbms SYSTEM BEFORE PRIVATE ${DIVIDE_INCLUDE_DIR}) |
| 334 | target_include_directories (dbms SYSTEM BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR}) |
| 335 | |
| 336 | if (USE_PROTOBUF) |
| 337 | target_link_libraries (dbms PRIVATE ${Protobuf_LIBRARY}) |
| 338 | target_include_directories (dbms SYSTEM BEFORE PRIVATE ${Protobuf_INCLUDE_DIR}) |
| 339 | endif () |
| 340 | |
| 341 | if (USE_HDFS) |
| 342 | target_link_libraries (clickhouse_common_io PRIVATE ${HDFS3_LIBRARY}) |
| 343 | target_include_directories (clickhouse_common_io SYSTEM BEFORE PRIVATE ${HDFS3_INCLUDE_DIR}) |
| 344 | endif() |
| 345 | |
| 346 | if (USE_BROTLI) |
| 347 | target_link_libraries (clickhouse_common_io PRIVATE ${BROTLI_LIBRARY}) |
| 348 | target_include_directories (clickhouse_common_io SYSTEM BEFORE PRIVATE ${BROTLI_INCLUDE_DIR}) |
| 349 | endif() |
| 350 | |
| 351 | if (USE_JEMALLOC) |
| 352 | target_include_directories (dbms SYSTEM BEFORE PRIVATE ${JEMALLOC_INCLUDE_DIR}) # used in Interpreters/AsynchronousMetrics.cpp |
| 353 | endif () |
| 354 | |
| 355 | target_include_directories (dbms PUBLIC ${DBMS_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/Formats/include) |
| 356 | target_include_directories (clickhouse_common_io PUBLIC ${DBMS_INCLUDE_DIR}) |
| 357 | target_include_directories (clickhouse_common_io SYSTEM PUBLIC ${PCG_RANDOM_INCLUDE_DIR}) |
| 358 | target_include_directories (clickhouse_common_io SYSTEM BEFORE PUBLIC ${DOUBLE_CONVERSION_INCLUDE_DIR}) |
| 359 | |
| 360 | # also for copy_headers.sh: |
| 361 | target_include_directories (clickhouse_common_io BEFORE PRIVATE ${COMMON_INCLUDE_DIR}) |
| 362 | |
| 363 | add_subdirectory (programs) |
| 364 | add_subdirectory (tests) |
| 365 | |
| 366 | if (ENABLE_TESTS AND USE_GTEST) |
| 367 | macro (grep_gtest_sources BASE_DIR DST_VAR) |
| 368 | # Cold match files that are not in tests/ directories |
| 369 | file(GLOB_RECURSE "${DST_VAR}" RELATIVE "${BASE_DIR}" "gtest*.cpp") |
| 370 | endmacro() |
| 371 | |
| 372 | # attach all dbms gtest sources |
| 373 | grep_gtest_sources(${ClickHouse_SOURCE_DIR}/dbms dbms_gtest_sources) |
| 374 | add_executable(unit_tests_dbms ${dbms_gtest_sources}) |
| 375 | target_link_libraries(unit_tests_dbms PRIVATE ${GTEST_BOTH_LIBRARIES} clickhouse_functions clickhouse_parsers dbms clickhouse_common_zookeeper) |
| 376 | add_check(unit_tests_dbms) |
| 377 | endif () |