Build fix

This commit is contained in:
Amos Bird 2019-09-11 10:53:56 +08:00
parent a446ec5e61
commit bf799fef92
3 changed files with 33 additions and 28 deletions

View File

@ -1,6 +1,7 @@
option (USE_CAPNP "Enable Cap'n Proto" ON)
option (ENABLE_CAPNP "Enable Cap'n Proto" ON)
if (ENABLE_CAPNP)
if (USE_CAPNP)
option (USE_INTERNAL_CAPNP_LIBRARY "Set to FALSE to use system capnproto library instead of bundled" ${NOT_UNBUNDLED})
# FIXME: refactor to use `add_library( IMPORTED)` if possible.
@ -16,5 +17,10 @@ if (USE_CAPNP)
set (CAPNP_LIBRARIES capnpc)
endif ()
message (STATUS "Using capnp: ${CAPNP_LIBRARIES}")
if (CAPNP_LIBRARIES)
set (USE_CAPNP 1)
endif ()
endif ()
message (STATUS "Using capnp: ${CAPNP_LIBRARIES}")

View File

@ -143,15 +143,14 @@ add_subdirectory(src/Common/Config)
set (all_modules)
macro(add_object_library name common_path)
if (MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
add_glob(dbms_headers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${common_path}/*.h)
add_glob(dbms_sources ${common_path}/*.cpp ${common_path}/*.c ${common_path}/*.h)
else ()
list (APPEND all_modules ${name})
add_glob(${name}_headers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${common_path}/*.h)
add_glob(${name}_sources ${common_path}/*.cpp ${common_path}/*.c ${common_path}/*.h)
if (MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
add_library(${name} OBJECT ${${name}_sources} ${${name}_headers})
else ()
add_library(${name} SHARED ${${name}_sources} ${${name}_headers})
# force all split libs to be linked
target_link_options(${name} PUBLIC "-Wl,--no-as-needed")
endif ()
endmacro()
@ -177,15 +176,15 @@ add_object_library(clickhouse_processors_transforms src/Processors/Transforms)
add_object_library(clickhouse_processors_sources src/Processors/Sources)
if (MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
foreach (module ${all_modules})
list (APPEND dbms_sources $<TARGET_OBJECTS:${module}>)
endforeach ()
add_library (dbms STATIC ${dbms_headers} ${dbms_sources})
set (all_modules dbms)
else()
add_library (dbms SHARED ${dbms_headers} ${dbms_sources})
target_link_libraries (dbms PUBLIC ${all_modules})
endif ()
list (APPEND all_modules dbms)
# force all split libs to be linked
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
endif ()
macro (dbms_target_include_directories)
foreach (module ${all_modules})
@ -390,6 +389,7 @@ endif ()
if (OPENSSL_CRYPTO_LIBRARY)
dbms_target_link_libraries (PRIVATE ${OPENSSL_CRYPTO_LIBRARY})
target_link_libraries (clickhouse_common_io PRIVATE ${OPENSSL_CRYPTO_LIBRARY})
endif ()
dbms_target_include_directories (SYSTEM BEFORE PRIVATE ${DIVIDE_INCLUDE_DIR})

View File

@ -15,7 +15,6 @@ if(USE_HYPERSCAN)
target_include_directories(clickhouse_functions_url SYSTEM PRIVATE ${HYPERSCAN_INCLUDE_DIR})
endif()
include(${ClickHouse_SOURCE_DIR}/cmake/find_gperf.cmake)
if (USE_GPERF)
# Only for regenerate
add_custom_target(generate-tldlookup-gperf ./tldLookup.sh