From 77a7a1ebb4f626668637e8ea5d0f7e90f4d862bf Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 13 Jan 2017 15:35:20 +0800 Subject: [PATCH] cmake: always build a static libceph-common Signed-off-by: Kefu Chai --- src/CMakeLists.txt | 34 ++++++++++++++++------------------ src/libcephd/CMakeLists.txt | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index da71587fcf4..1dc54a78b55 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -544,16 +544,15 @@ else() endif() add_library(common-objs OBJECT ${libcommon_files}) -add_library(ceph-common SHARED +set(ceph_common_objs $ $ $ $ $ $) -set_target_properties(ceph-common PROPERTIES - INSTALL_RPATH "") -target_link_libraries(ceph-common json_spirit erasure_code rt ${LIB_RESOLV} +set(ceph_common_deps + json_spirit erasure_code rt ${LIB_RESOLV} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} @@ -564,19 +563,7 @@ target_link_libraries(ceph-common json_spirit erasure_code rt ${LIB_RESOLV} ${BLKID_LIBRARIES} ${Backtrace_LIBRARIES} ${CRYPTO_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) if(NOT WITH_SYSTEM_BOOST) - target_link_libraries(ceph-common ${ZLIB_LIBRARIES}) -endif() -# appease dpkg-shlibdeps -set_target_properties(ceph-common PROPERTIES - SOVERSION 0) -install(TARGETS ceph-common DESTINATION ${CMAKE_INSTALL_PKGLIBDIR}) -if(WITH_EMBEDDED) - add_library(cephd_common STATIC - $ - $ - $ - $ - $) + list(APPEND ceph_common_deps ${ZLIB_LIBRARIES}) endif() set_source_files_properties(${CMAKE_SOURCE_DIR}/src/ceph_ver.c @@ -587,9 +574,20 @@ set_source_files_properties(${CMAKE_SOURCE_DIR}/src/ceph_ver.c include(SIMDExt) if(HAVE_ARMV8_CRC) add_library(common_crc_aarch64 STATIC common/crc32c_aarch64.c) - target_link_libraries(ceph-common common_crc_aarch64) + list(APPEND ceph_common_deps common_crc_aarch64) endif(HAVE_ARMV8_CRC) +add_library(common STATIC ${ceph_common_objs}) +target_link_libraries(common ${ceph_common_deps}) + +add_library(ceph-common SHARED ${ceph_common_objs}) +target_link_libraries(ceph-common ${ceph_common_deps}) +# appease dpkg-shlibdeps +set_target_properties(ceph-common PROPERTIES + SOVERSION 0 + INSTALL_RPATH "") +install(TARGETS ceph-common DESTINATION ${CMAKE_INSTALL_PKGLIBDIR}) + add_library(common_utf8 STATIC common/utf8.c) if(${WITH_LTTNG}) diff --git a/src/libcephd/CMakeLists.txt b/src/libcephd/CMakeLists.txt index db387f28d10..5ace601a15b 100644 --- a/src/libcephd/CMakeLists.txt +++ b/src/libcephd/CMakeLists.txt @@ -17,7 +17,7 @@ set(merge_libs cephd_rados cephd_rbd cephd_rgw - cephd_common + common common_utf8 erasure_code global -- 2.39.5