]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: link ceph-{mds,mgr,mon,osd} against libcommon
authorKefu Chai <kchai@redhat.com>
Fri, 13 Jan 2017 07:41:15 +0000 (15:41 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 20 Jan 2017 09:56:28 +0000 (17:56 +0800)
add a static library named global-static, which does not link with
libceph-common. so the executables which does not link against
lib{rados,cephfs,rbd} can be linked against global-static instead if
they want to access the symbols previously available from libglobal.
and libglobal is now linked against libceph-common. and it is supposed
to be used by executables packaged by ceph-test. these exectuables can
safely depend on libceph-common offered by package of "librados2".

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/CMakeLists.txt
src/global/CMakeLists.txt
src/mds/CMakeLists.txt

index 1dc54a78b559374935991dc309053254b7adc47d..86c93e2ff0f9dad42d865ba75ce09cd426de2719 100644 (file)
@@ -626,7 +626,7 @@ if (WITH_MGR)
   add_executable(ceph-mgr ${mgr_srcs}
                  $<TARGET_OBJECTS:heap_profiler_objs>)
   target_include_directories(ceph-mgr PRIVATE "${PYTHON_INCLUDE_DIRS}")
-  target_link_libraries(ceph-mgr mds osdc global
+  target_link_libraries(ceph-mgr mds osdc global-static common
       ${Boost_PYTHON_LIBRARY} ${PYTHON_LIBRARIES} ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS} ${ALLOC_LIBS})
   install(TARGETS ceph-mgr DESTINATION bin)
 endif (WITH_MGR)
@@ -716,7 +716,8 @@ set(ceph_mon_srcs
 add_executable(ceph-mon ${ceph_mon_srcs}
   $<TARGET_OBJECTS:common_texttable_obj>)
 add_dependencies(ceph-mon erasure_code_plugins)
-      target_link_libraries(ceph-mon mon ceph-common os global ${EXTRALIBS}
+target_link_libraries(ceph-mon mon common os global-static common
+  ${EXTRALIBS}
   ${CMAKE_DL_LIBS})
 install(TARGETS ceph-mon DESTINATION bin)
 
@@ -782,7 +783,8 @@ set(ceph_osd_srcs
 add_executable(ceph-osd ${ceph_osd_srcs}
   $<TARGET_OBJECTS:common_util_obj>)
 add_dependencies(ceph-osd erasure_code_plugins)
-target_link_libraries(ceph-osd osd os global ${BLKID_LIBRARIES} ${RDMA_LIBRARIES})
+target_link_libraries(ceph-osd osd os global-static common
+  ${BLKID_LIBRARIES} ${RDMA_LIBRARIES})
 if(WITH_FUSE)
   target_link_libraries(ceph-osd ${FUSE_LIBRARIES})
 endif()
@@ -793,7 +795,7 @@ set(ceph_mds_srcs
   ceph_mds.cc)
 add_executable(ceph-mds ${ceph_mds_srcs}
   $<TARGET_OBJECTS:common_util_obj>)
-target_link_libraries(ceph-mds mds ${CMAKE_DL_LIBS} global
+target_link_libraries(ceph-mds mds ${CMAKE_DL_LIBS} global-static common
   ${Boost_THREAD_LIBRARY})
 install(TARGETS ceph-mds DESTINATION bin)
 
@@ -897,7 +899,7 @@ if(WITH_LIBCEPHFS)
     ceph_syn.cc
     client/SyntheticClient.cc)
   add_executable(ceph-syn ${ceph_syn_srcs})
-  target_link_libraries(ceph-syn client global)
+  target_link_libraries(ceph-syn client global-static)
 
   set(mount_ceph_srcs
     mount/mount.ceph.c)
@@ -916,7 +918,8 @@ if(WITH_LIBCEPHFS)
       ceph_fuse.cc
       client/fuse_ll.cc)
     add_executable(ceph-fuse ${ceph_fuse_srcs})
-    target_link_libraries(ceph-fuse ${ALLOC_LIBS} ${FUSE_LIBRARIES} client global)
+    target_link_libraries(ceph-fuse ${ALLOC_LIBS} ${FUSE_LIBRARIES}
+      client global-static)
     set_target_properties(ceph-fuse PROPERTIES COMPILE_FLAGS "-I${FUSE_INCLUDE_DIRS}")
     install(TARGETS ceph-fuse DESTINATION bin)
     install(PROGRAMS mount.fuse.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
index 079d78bbc2966e418bad8d741185abc3a956235b..46de512f5c9f1d3e437d19e61ddcc6786a7095a9 100644 (file)
@@ -5,6 +5,13 @@ set(libglobal_srcs
 set(global_common_files
   global_context.cc)
 add_library(global_common_objs OBJECT ${global_common_files})
-add_library(global STATIC ${libglobal_srcs}
+add_library(libglobal_objs OBJECT ${libglobal_srcs})
+
+add_library(global-static STATIC
+  $<TARGET_OBJECTS:libglobal_objs>
+  $<TARGET_OBJECTS:global_common_objs>)
+
+add_library(global STATIC
+  $<TARGET_OBJECTS:libglobal_objs>
   $<TARGET_OBJECTS:global_common_objs>)
 target_link_libraries(global ceph-common ${DPDK_LIBRARIES} ${EXTRALIBS})
index d6f7645cdd793879ea5339f59ead00d27c4a71ac..72d370992a65587850296302da58b62bddd1cefd 100644 (file)
@@ -40,4 +40,4 @@ set(mds_srcs
 add_library(mds STATIC ${mds_srcs}
   $<TARGET_OBJECTS:heap_profiler_objs>
   $<TARGET_OBJECTS:common_util_obj>)
-target_link_libraries(mds ${ALLOC_LIBS} osdc ceph-common liblua)
+target_link_libraries(mds ${ALLOC_LIBS} osdc liblua)