From 1cb0ba585490de286890c1c730c1d931f221a209 Mon Sep 17 00:00:00 2001 From: proller Date: Tue, 18 Jun 2019 20:10:25 +0300 Subject: [PATCH] Cmake: better USE_STATIC_LIBRARIES and SPLIT_SHARED_LIBRARIES handling --- CMakeLists.txt | 29 ++++++++++++++++++++-- libs/libglibc-compatibility/CMakeLists.txt | 2 +- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19cf0388d98..7b33cf0f430 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,11 @@ if (NOT MAKE_STATIC_LIBRARIES) option (CLICKHOUSE_SPLIT_BINARY "Make several binaries instead one bundled (clickhouse-server, clickhouse-client, ... )" OFF) endif () -if (SPLIT_SHARED_LIBRARIES) +if(MAKE_STATIC_LIBRARIES AND SPLIT_SHARED_LIBRARIES) + message(WARNING "Defining SPLIT_SHARED_LIBRARIES=1 without MAKE_STATIC_LIBRARIES=0 have no effect.") +endif() + +if (NOT MAKE_STATIC_LIBRARIES AND SPLIT_SHARED_LIBRARIES) set(BUILD_SHARED_LIBS 1 CACHE INTERNAL "") endif () @@ -110,7 +114,7 @@ option (ENABLE_TESTS "Enables tests" ON) if (CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64") option (USE_INTERNAL_MEMCPY "Use internal implementation of 'memcpy' function instead of provided by libc. Only for x86_64." ON) - if (OS_LINUX AND NOT UNBUNDLED AND MAKE_STATIC_LIBRARIES AND CMAKE_VERSION VERSION_GREATER "3.9.0") + if (OS_LINUX AND NOT UNBUNDLED AND MAKE_STATIC_LIBRARIES AND NOT SPLIT_SHARED_LIBRARIES AND CMAKE_VERSION VERSION_GREATER "3.9.0") option (GLIBC_COMPATIBILITY "Set to TRUE to enable compatibility with older glibc libraries. Only for x86_64, Linux. Implies USE_INTERNAL_MEMCPY." ON) endif () endif () @@ -384,5 +388,26 @@ if (GLIBC_COMPATIBILITY) add_glibc_compat(arrow) add_glibc_compat(protoc) add_glibc_compat(thrift_static) + add_glibc_compat(cityhash) + add_glibc_compat(farmhash) + add_glibc_compat(murmurhash) + add_glibc_compat(metrohash) + add_glibc_compat(metrohash128) + add_glibc_compat(consistent-hashing) + add_glibc_compat(double-conversion) + add_glibc_compat(cctz) + add_glibc_compat(kj) + add_glibc_compat(simdjson) + add_glibc_compat(apple_rt) + add_glibc_compat(re2) + add_glibc_compat(re2_st) + add_glibc_compat(hs_compile_shared) + add_glibc_compat(hs_exec_shared) + add_glibc_compat(hs_shared) + add_glibc_compat(widechar_width) + add_glibc_compat(string_utils) + add_glibc_compat(consistent-hashing-sumbur) + add_glibc_compat(boost_program_options_internal) + add_glibc_compat(boost_system_internal) add_glibc_compat(boost_regex_internal) endif () diff --git a/libs/libglibc-compatibility/CMakeLists.txt b/libs/libglibc-compatibility/CMakeLists.txt index c5824553118..fe98ae9bf0d 100644 --- a/libs/libglibc-compatibility/CMakeLists.txt +++ b/libs/libglibc-compatibility/CMakeLists.txt @@ -20,6 +20,6 @@ if(MAKE_STATIC_LIBRARIES) list(APPEND glibc_compatibility_sources libcxxabi/cxa_thread_atexit.cpp) endif() -add_library(glibc-compatibility ${glibc_compatibility_sources}) +add_library(glibc-compatibility STATIC ${glibc_compatibility_sources}) target_include_directories(glibc-compatibility PRIVATE libcxxabi)