]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: always build a static libceph-common
authorKefu Chai <kchai@redhat.com>
Fri, 13 Jan 2017 07:35:20 +0000 (15:35 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 20 Jan 2017 08:48:36 +0000 (16:48 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/CMakeLists.txt
src/libcephd/CMakeLists.txt

index da71587fcf42bdcd382bd8c7edeea24b3967dd53..1dc54a78b559374935991dc309053254b7adc47d 100644 (file)
@@ -544,16 +544,15 @@ else()
 endif()
 
 add_library(common-objs OBJECT ${libcommon_files})
-add_library(ceph-common SHARED
+set(ceph_common_objs
   $<TARGET_OBJECTS:common_buffer_obj>
   $<TARGET_OBJECTS:common_texttable_obj>
   $<TARGET_OBJECTS:compressor_objs>
   $<TARGET_OBJECTS:common-objs>
   $<TARGET_OBJECTS:common_mountcephfs_objs>
   $<TARGET_OBJECTS:global_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
-    $<TARGET_OBJECTS:common_buffer_obj>
-    $<TARGET_OBJECTS:common_texttable_obj>
-    $<TARGET_OBJECTS:compressor_objs>
-    $<TARGET_OBJECTS:common-objs>
-    $<TARGET_OBJECTS:common_mountcephfs_objs>)
+  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})
index db387f28d10e4e783a2a4947aefb0f505fe74ec0..5ace601a15bd27b6da172d0eab30c0ac8c3d026d 100644 (file)
@@ -17,7 +17,7 @@ set(merge_libs
   cephd_rados
   cephd_rbd
   cephd_rgw
-  cephd_common
+  common
   common_utf8
   erasure_code
   global