2018-07-30 20:36:23 +00:00
|
|
|
# Third-party libraries may have substandard code.
|
|
|
|
|
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
2018-08-19 03:42:43 +00:00
|
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-result -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-format -Wno-misleading-indentation -Wno-stringop-overflow")
|
2018-09-02 01:54:24 +00:00
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-result -Wno-deprecated-declarations -Wno-non-virtual-dtor -Wno-maybe-uninitialized -Wno-format -Wno-misleading-indentation -Wno-implicit-fallthrough -Wno-class-memaccess -std=c++1z")
|
2018-07-30 20:36:23 +00:00
|
|
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
2018-08-19 05:53:02 +00:00
|
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function -Wno-unused-variable -Wno-unused-result -Wno-deprecated-declarations -Wno-format -Wno-parentheses-equality")
|
2018-07-30 20:36:23 +00:00
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast -Wno-unused-function -Wno-unused-variable -Wno-unused-result -Wno-deprecated-declarations -Wno-non-virtual-dtor -Wno-format -std=c++1z")
|
2018-03-02 00:17:25 +00:00
|
|
|
endif ()
|
2016-08-25 21:55:02 +00:00
|
|
|
|
2016-12-20 13:48:32 +00:00
|
|
|
if (USE_INTERNAL_BOOST_LIBRARY)
|
2018-03-02 20:01:54 +00:00
|
|
|
add_subdirectory (boost-cmake)
|
2016-12-20 13:48:32 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-02-28 23:49:04 +00:00
|
|
|
if (USE_INTERNAL_LZ4_LIBRARY)
|
2017-10-13 18:52:23 +00:00
|
|
|
add_subdirectory (lz4-cmake)
|
2017-02-28 23:49:04 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (USE_INTERNAL_ZSTD_LIBRARY)
|
2017-10-13 18:52:23 +00:00
|
|
|
add_subdirectory (zstd-cmake)
|
2017-02-28 23:49:04 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (USE_INTERNAL_RE2_LIBRARY)
|
2018-01-22 13:47:00 +00:00
|
|
|
set(RE2_BUILD_TESTING 0 CACHE INTERNAL "")
|
|
|
|
add_subdirectory (re2)
|
|
|
|
add_subdirectory (re2_st)
|
2017-02-28 23:49:04 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (USE_INTERNAL_DOUBLE_CONVERSION_LIBRARY)
|
2018-05-11 11:04:39 +00:00
|
|
|
set (BUILD_TESTING 0 CACHE INTERNAL "")
|
2018-01-16 17:25:25 +00:00
|
|
|
add_subdirectory (double-conversion)
|
2017-02-28 23:49:04 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-08-09 20:52:55 +00:00
|
|
|
if (USE_INTERNAL_CITYHASH_LIBRARY)
|
2018-06-19 18:09:09 +00:00
|
|
|
add_subdirectory (cityhash102)
|
2017-08-09 20:52:55 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (USE_INTERNAL_FARMHASH_LIBRARY)
|
|
|
|
add_subdirectory (libfarmhash)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (USE_INTERNAL_METROHASH_LIBRARY)
|
|
|
|
add_subdirectory (libmetrohash)
|
|
|
|
endif ()
|
|
|
|
|
2018-08-03 18:47:44 +00:00
|
|
|
add_subdirectory (murmurhash)
|
|
|
|
|
2017-08-09 20:52:55 +00:00
|
|
|
if (USE_INTERNAL_BTRIE_LIBRARY)
|
|
|
|
add_subdirectory (libbtrie)
|
|
|
|
endif ()
|
2017-06-23 14:41:07 +00:00
|
|
|
|
|
|
|
if (USE_INTERNAL_UNWIND_LIBRARY)
|
2017-09-04 17:04:33 +00:00
|
|
|
add_subdirectory (libunwind)
|
2017-06-23 14:41:07 +00:00
|
|
|
endif ()
|
2017-02-28 23:49:04 +00:00
|
|
|
|
2017-02-07 21:28:13 +00:00
|
|
|
if (USE_INTERNAL_ZLIB_LIBRARY)
|
2018-08-28 17:53:12 +00:00
|
|
|
set (ZLIB_COMPAT 1 CACHE INTERNAL "") # also enables WITH_GZFILEOP
|
2018-11-10 20:09:07 +00:00
|
|
|
set (WITH_NATIVE_INSTRUCTIONS ${ARCH_NATIVE} CACHE INTERNAL "")
|
2018-08-28 17:53:12 +00:00
|
|
|
if (OS_FREEBSD OR ARCH_I386)
|
|
|
|
set (WITH_OPTIM 0 CACHE INTERNAL "") # Bug in assembler
|
|
|
|
endif ()
|
|
|
|
if (ARCH_AARCH64)
|
|
|
|
set(WITH_NEON 1 CACHE INTERNAL "")
|
|
|
|
set(WITH_ACLE 1 CACHE INTERNAL "")
|
|
|
|
endif ()
|
|
|
|
|
2018-03-02 00:17:25 +00:00
|
|
|
add_subdirectory (${INTERNAL_ZLIB_NAME})
|
2017-11-21 17:46:28 +00:00
|
|
|
# todo: make pull to Dead2/zlib-ng and remove:
|
|
|
|
# We should use same defines when including zlib.h as used when zlib compiled
|
|
|
|
target_compile_definitions (zlib PUBLIC ZLIB_COMPAT WITH_GZFILEOP)
|
|
|
|
target_compile_definitions (zlibstatic PUBLIC ZLIB_COMPAT WITH_GZFILEOP)
|
2017-11-30 17:09:33 +00:00
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64")
|
2018-08-27 18:32:50 +00:00
|
|
|
target_compile_definitions (zlib PUBLIC X86_64 UNALIGNED_OK)
|
|
|
|
target_compile_definitions (zlibstatic PUBLIC X86_64 UNALIGNED_OK)
|
2017-11-30 17:09:33 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-11-22 12:15:17 +00:00
|
|
|
set_target_properties(example PROPERTIES EXCLUDE_FROM_ALL 1)
|
2017-11-24 19:24:07 +00:00
|
|
|
if (TARGET example64)
|
|
|
|
set_target_properties(example64 PROPERTIES EXCLUDE_FROM_ALL 1)
|
|
|
|
endif ()
|
2018-01-18 20:33:16 +00:00
|
|
|
|
|
|
|
set_target_properties(minigzip PROPERTIES EXCLUDE_FROM_ALL 1)
|
2017-11-24 19:24:07 +00:00
|
|
|
if (TARGET minigzip64)
|
|
|
|
set_target_properties(minigzip64 PROPERTIES EXCLUDE_FROM_ALL 1)
|
|
|
|
endif ()
|
2017-02-07 21:28:13 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-06-23 14:41:07 +00:00
|
|
|
if (USE_INTERNAL_CCTZ_LIBRARY)
|
2017-11-02 18:55:52 +00:00
|
|
|
add_subdirectory (cctz-cmake)
|
2017-06-23 14:41:07 +00:00
|
|
|
endif ()
|
2016-02-07 21:58:58 +00:00
|
|
|
|
2017-11-28 19:57:15 +00:00
|
|
|
if (ENABLE_TCMALLOC AND USE_INTERNAL_GPERFTOOLS_LIBRARY)
|
2017-10-24 19:18:15 +00:00
|
|
|
add_subdirectory (libtcmalloc)
|
2016-12-01 22:44:59 +00:00
|
|
|
endif ()
|
2016-11-28 15:35:13 +00:00
|
|
|
|
2018-08-02 00:20:20 +00:00
|
|
|
if (ENABLE_JEMALLOC AND USE_INTERNAL_JEMALLOC_LIBRARY)
|
|
|
|
add_subdirectory (jemalloc-cmake)
|
|
|
|
endif ()
|
|
|
|
|
2018-07-09 16:06:25 +00:00
|
|
|
if (USE_INTERNAL_CPUID_LIBRARY)
|
2017-09-04 17:04:33 +00:00
|
|
|
add_subdirectory (libcpuid)
|
2017-08-31 17:11:30 +00:00
|
|
|
endif ()
|
2017-10-06 04:40:18 +00:00
|
|
|
|
2018-03-02 00:17:25 +00:00
|
|
|
if (USE_INTERNAL_SSL_LIBRARY)
|
|
|
|
if (NOT MAKE_STATIC_LIBRARIES)
|
|
|
|
set (BUILD_SHARED 1)
|
|
|
|
endif ()
|
|
|
|
set (USE_SHARED ${USE_STATIC_LIBRARIES})
|
2018-08-05 09:36:10 +00:00
|
|
|
set (LIBRESSL_SKIP_INSTALL 1)
|
2018-03-02 00:17:25 +00:00
|
|
|
add_subdirectory (ssl)
|
2018-08-10 02:24:10 +00:00
|
|
|
target_include_directories(${OPENSSL_CRYPTO_LIBRARY} SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR})
|
|
|
|
target_include_directories(${OPENSSL_SSL_LIBRARY} SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR})
|
2018-03-02 00:17:25 +00:00
|
|
|
endif ()
|
|
|
|
|
2018-08-02 00:49:31 +00:00
|
|
|
if (ENABLE_MYSQL AND USE_INTERNAL_MYSQL_LIBRARY)
|
|
|
|
add_subdirectory (mariadb-connector-c-cmake)
|
2018-08-23 10:25:18 +00:00
|
|
|
target_include_directories(mysqlclient BEFORE PRIVATE ${ZLIB_INCLUDE_DIR})
|
|
|
|
target_include_directories(mysqlclient BEFORE PRIVATE ${OPENSSL_INCLUDE_DIR})
|
2018-08-02 00:49:31 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-10-06 04:40:18 +00:00
|
|
|
if (USE_INTERNAL_RDKAFKA_LIBRARY)
|
2018-08-09 23:02:52 +00:00
|
|
|
add_subdirectory (librdkafka-cmake)
|
2018-08-23 10:25:18 +00:00
|
|
|
target_include_directories(rdkafka BEFORE PRIVATE ${ZLIB_INCLUDE_DIR})
|
|
|
|
target_include_directories(rdkafka BEFORE PRIVATE ${OPENSSL_INCLUDE_DIR})
|
2017-10-13 19:24:37 +00:00
|
|
|
endif ()
|
2017-10-13 20:52:42 +00:00
|
|
|
|
2018-08-02 08:18:15 +00:00
|
|
|
if (ENABLE_ODBC AND USE_INTERNAL_ODBC_LIBRARY)
|
|
|
|
add_subdirectory (unixodbc-cmake)
|
|
|
|
endif ()
|
|
|
|
|
2018-01-11 18:39:52 +00:00
|
|
|
if (USE_INTERNAL_CAPNP_LIBRARY)
|
2018-05-11 11:04:39 +00:00
|
|
|
set (BUILD_TESTING 0 CACHE INTERNAL "")
|
2018-01-11 18:39:52 +00:00
|
|
|
set (_save ${CMAKE_CXX_EXTENSIONS})
|
|
|
|
set (CMAKE_CXX_EXTENSIONS)
|
|
|
|
add_subdirectory (capnproto/c++)
|
|
|
|
set (CMAKE_CXX_EXTENSIONS ${_save})
|
|
|
|
target_include_directories(${CAPNP_LIBRARY} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/capnproto/c++/src>)
|
|
|
|
endif ()
|
|
|
|
|
2017-10-13 18:58:19 +00:00
|
|
|
if (USE_INTERNAL_POCO_LIBRARY)
|
2018-01-13 01:16:23 +00:00
|
|
|
set (save_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
|
|
set (save_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
2017-10-13 18:58:19 +00:00
|
|
|
set (_save ${ENABLE_TESTS})
|
|
|
|
set (ENABLE_TESTS 0)
|
2018-09-28 14:53:20 +00:00
|
|
|
set (POCO_ENABLE_TESTS 0)
|
2017-10-13 18:58:19 +00:00
|
|
|
set (CMAKE_DISABLE_FIND_PACKAGE_ZLIB 1)
|
2018-03-23 16:05:14 +00:00
|
|
|
if (MSVC)
|
|
|
|
set (ENABLE_DATA_ODBC 0 CACHE INTERNAL "") # TODO (build fail)
|
2018-03-02 00:17:25 +00:00
|
|
|
endif ()
|
2017-10-13 18:58:19 +00:00
|
|
|
add_subdirectory (poco)
|
|
|
|
unset (CMAKE_DISABLE_FIND_PACKAGE_ZLIB)
|
|
|
|
set (ENABLE_TESTS ${_save})
|
2018-01-13 01:16:23 +00:00
|
|
|
set (CMAKE_CXX_FLAGS ${save_CMAKE_CXX_FLAGS})
|
|
|
|
set (CMAKE_C_FLAGS ${save_CMAKE_C_FLAGS})
|
2018-05-14 17:30:30 +00:00
|
|
|
|
2018-05-14 18:36:01 +00:00
|
|
|
if (OPENSSL_FOUND AND TARGET Crypto AND (NOT DEFINED ENABLE_POCO_NETSSL OR ENABLE_POCO_NETSSL))
|
|
|
|
# Bug in poco https://github.com/pocoproject/poco/pull/2100 found on macos
|
2018-08-10 02:24:10 +00:00
|
|
|
target_include_directories(Crypto SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR})
|
2018-01-19 17:04:32 +00:00
|
|
|
endif ()
|
2017-10-13 18:58:19 +00:00
|
|
|
endif ()
|
2018-05-09 20:31:03 +00:00
|
|
|
|
2018-11-16 12:22:51 +00:00
|
|
|
if (USE_INTERNAL_GTEST_LIBRARY)
|
|
|
|
# Google Test from sources
|
|
|
|
add_subdirectory(${ClickHouse_SOURCE_DIR}/contrib/googletest/googletest ${CMAKE_CURRENT_BINARY_DIR}/googletest)
|
|
|
|
# avoid problems with <regexp.h>
|
|
|
|
target_compile_definitions (gtest INTERFACE GTEST_HAS_POSIX_RE=0)
|
|
|
|
target_include_directories (gtest SYSTEM INTERFACE ${ClickHouse_SOURCE_DIR}/contrib/googletest/include)
|
|
|
|
endif ()
|
|
|
|
|
2018-05-09 20:31:03 +00:00
|
|
|
if (USE_INTERNAL_LLVM_LIBRARY)
|
2018-11-16 12:22:51 +00:00
|
|
|
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/empty.cpp CONTENT " ")
|
|
|
|
add_library(LLVM0 ${CMAKE_CURRENT_BINARY_DIR}/empty.cpp) # silly cmake bug fix
|
2018-07-16 14:13:15 +00:00
|
|
|
# ld: unknown option: --color-diagnostics
|
2018-08-20 16:34:28 +00:00
|
|
|
if (APPLE)
|
2018-07-16 14:13:15 +00:00
|
|
|
set (LINKER_SUPPORTS_COLOR_DIAGNOSTICS 0 CACHE INTERNAL "")
|
|
|
|
endif ()
|
2018-11-10 20:09:07 +00:00
|
|
|
set (LLVM_ENABLE_EH 1 CACHE INTERNAL "")
|
|
|
|
set (LLVM_ENABLE_RTTI 1 CACHE INTERNAL "")
|
2018-11-16 12:22:51 +00:00
|
|
|
set (LLVM_INCLUDE_TESTS 0 CACHE INTERNAL "")
|
|
|
|
set (LLVM_INCLUDE_EXAMPLES 0 CACHE INTERNAL "")
|
|
|
|
set (LLVM_INCLUDE_TOOLS 0 CACHE INTERNAL "")
|
|
|
|
set (LLVM_INSTALL_TOOLCHAIN_ONLY 0 CACHE INTERNAL "")
|
|
|
|
set (CLANG_BUILT_STANDALONE 0 CACHE INTERNAL "")
|
|
|
|
set (LLDB_BUILT_STANDALONE 0 CACHE INTERNAL "")
|
|
|
|
set (CLANG_ENABLE_STATIC_ANALYZER 0 CACHE INTERNAL "")
|
|
|
|
set (CLANG_ENABLE_ARCMT 0 CACHE INTERNAL "")
|
|
|
|
set (CLANG_BUILD_TOOLS 0 CACHE INTERNAL "")
|
|
|
|
set (BENCHMARK_ENABLE_GTEST_TESTS 0 CACHE INTERNAL "")
|
|
|
|
set (BENCHMARK_ENABLE_ASSEMBLY_TESTS 0 CACHE INTERNAL "")
|
|
|
|
set (LLVM_TARGETS_TO_BUILD "X86;AArch64" CACHE INTERNAL "")
|
2018-05-09 20:31:03 +00:00
|
|
|
add_subdirectory (llvm/llvm)
|
|
|
|
endif ()
|
2018-08-26 01:58:56 +00:00
|
|
|
|
2018-10-11 16:22:50 +00:00
|
|
|
if (USE_BASE64)
|
|
|
|
add_subdirectory (base64-cmake)
|
2018-11-23 18:33:56 +00:00
|
|
|
endif()
|