Cmake: better USE_STATIC_LIBRARIES and SPLIT_SHARED_LIBRARIES handling

This commit is contained in:
proller 2019-06-18 20:10:25 +03:00
parent 4f98f875c3
commit 1cb0ba5854
2 changed files with 28 additions and 3 deletions

View File

@ -67,7 +67,11 @@ if (NOT MAKE_STATIC_LIBRARIES)
option (CLICKHOUSE_SPLIT_BINARY "Make several binaries instead one bundled (clickhouse-server, clickhouse-client, ... )" OFF) option (CLICKHOUSE_SPLIT_BINARY "Make several binaries instead one bundled (clickhouse-server, clickhouse-client, ... )" OFF)
endif () 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 "") set(BUILD_SHARED_LIBS 1 CACHE INTERNAL "")
endif () endif ()
@ -110,7 +114,7 @@ option (ENABLE_TESTS "Enables tests" ON)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64") 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) 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) 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 ()
endif () endif ()
@ -384,5 +388,26 @@ if (GLIBC_COMPATIBILITY)
add_glibc_compat(arrow) add_glibc_compat(arrow)
add_glibc_compat(protoc) add_glibc_compat(protoc)
add_glibc_compat(thrift_static) 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) add_glibc_compat(boost_regex_internal)
endif () endif ()

View File

@ -20,6 +20,6 @@ if(MAKE_STATIC_LIBRARIES)
list(APPEND glibc_compatibility_sources libcxxabi/cxa_thread_atexit.cpp) list(APPEND glibc_compatibility_sources libcxxabi/cxa_thread_atexit.cpp)
endif() endif()
add_library(glibc-compatibility ${glibc_compatibility_sources}) add_library(glibc-compatibility STATIC ${glibc_compatibility_sources})
target_include_directories(glibc-compatibility PRIVATE libcxxabi) target_include_directories(glibc-compatibility PRIVATE libcxxabi)