]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: restructure src/CMakeLists.txt in a more hierarchical way
authorKefu Chai <kchai@redhat.com>
Thu, 14 Jul 2016 06:50:31 +0000 (14:50 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 16 Jul 2016 04:00:47 +0000 (12:00 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/CMakeLists.txt
src/tools/CMakeLists.txt [new file with mode: 0644]
src/tools/rbd/CMakeLists.txt [new file with mode: 0644]
src/tools/rbd_mirror/CMakeLists.txt [new file with mode: 0644]
src/tools/rbd_nbd/CMakeLists.txt [new file with mode: 0644]

index f679b372715404cdb1fdce307a7f07b9ddfcb960..12254d45a60efaa9a8f9fc586f1a6f386c21b7b7 100644 (file)
@@ -1029,44 +1029,7 @@ set_target_properties(cephfstool PROPERTIES OUTPUT_NAME cephfs)
 install(TARGETS cephfstool DESTINATION bin)
 
 add_subdirectory(compressor)
-
-add_executable(ceph-client-debug tools/ceph-client-debug.cc)
-target_link_libraries(ceph-client-debug cephfs librados global common)
-install(TARGETS ceph-client-debug DESTINATION bin)
-
-add_executable(ceph-kvstore-tool tools/ceph_kvstore_tool.cc)
-target_link_libraries(ceph-kvstore-tool os global ${UNITTEST_CXX_FLAGS})
-install(TARGETS ceph-kvstore-tool DESTINATION bin)
-
-set(ceph_conf_srcs
-  tools/ceph_conf.cc)
-add_executable(ceph-conf ${ceph_conf_srcs})
-target_link_libraries(ceph-conf global)
-install(TARGETS ceph-conf DESTINATION bin)
-
-set(monmaptool_srcs
-  tools/monmaptool.cc)
-add_executable(monmaptool ${monmaptool_srcs})
-target_link_libraries(monmaptool global)
-install(TARGETS monmaptool DESTINATION bin)
-
-set(osdomaptool_srcs
-  tools/osdmaptool.cc)
-add_executable(osdmaptool ${osdomaptool_srcs})
-target_link_libraries(osdmaptool global)
-install(TARGETS osdmaptool DESTINATION bin)
-
-set(ceph_psim_srcs
-  tools/psim.cc)
-add_executable(ceph_psim ${ceph_psim_srcs})
-target_link_libraries(ceph_psim global)
-install(TARGETS ceph_psim DESTINATION bin)
-
-set(ceph_authtool_srcs
-  tools/ceph_authtool.cc)
-add_executable(ceph-authtool ${ceph_authtool_srcs})
-target_link_libraries(ceph-authtool global ${EXTRALIBS} ${CRYPTO_LIBS})
-install(TARGETS ceph-authtool DESTINATION bin)
+add_subdirectory(tools)
 
 configure_file(${CMAKE_SOURCE_DIR}/src/ceph-coverage.in
   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-coverage @ONLY)
@@ -1204,37 +1167,6 @@ if(${WITH_RBD})
     include/rbd/librbd.hpp
     DESTINATION include/rbd)
 
-  add_executable(rbd-nbd tools/rbd_nbd/rbd-nbd.cc
-    $<TARGET_OBJECTS:parse_secret_objs>)
-  target_link_libraries(rbd-nbd librbd librados global keyutils
-    ${Boost_REGEX_LIBRARY})
-
-  set(rbd_mirror_internal
-    tools/rbd_mirror/ClusterWatcher.cc
-    tools/rbd_mirror/ImageReplayer.cc
-    tools/rbd_mirror/ImageDeleter.cc
-    tools/rbd_mirror/ImageSync.cc
-    tools/rbd_mirror/ImageSyncThrottler.cc
-    tools/rbd_mirror/Mirror.cc
-    tools/rbd_mirror/PoolWatcher.cc
-    tools/rbd_mirror/Replayer.cc
-    tools/rbd_mirror/Threads.cc
-    tools/rbd_mirror/types.cc
-    tools/rbd_mirror/image_replayer/BootstrapRequest.cc
-    tools/rbd_mirror/image_replayer/CloseImageRequest.cc
-    tools/rbd_mirror/image_replayer/CreateImageRequest.cc
-    tools/rbd_mirror/image_replayer/OpenImageRequest.cc
-    tools/rbd_mirror/image_replayer/OpenLocalImageRequest.cc
-    tools/rbd_mirror/image_replayer/ReplayStatusFormatter.cc
-    tools/rbd_mirror/image_sync/ImageCopyRequest.cc
-    tools/rbd_mirror/image_sync/ObjectCopyRequest.cc
-    tools/rbd_mirror/image_sync/SnapshotCopyRequest.cc
-    tools/rbd_mirror/image_sync/SnapshotCreateRequest.cc
-    tools/rbd_mirror/image_sync/SyncPointCreateRequest.cc
-    tools/rbd_mirror/image_sync/SyncPointPruneRequest.cc)
-  add_library(rbd_mirror_internal STATIC
-    ${rbd_mirror_internal})
-
   if(WITH_FUSE)
     add_executable(rbd-fuse
       rbd_fuse/rbd-fuse.cc)
@@ -1243,70 +1175,6 @@ if(${WITH_RBD})
     install(TARGETS rbd-fuse DESTINATION bin)
   endif()
 
-  add_executable(rbd-mirror
-    tools/rbd_mirror/main.cc
-    common/ContextCompletion.cc)
-  target_link_libraries(rbd-mirror
-    rbd_mirror_internal
-    rbd_internal
-    rbd_api
-    rbd_types
-    journal
-    librados
-    osdc
-    cls_rbd_client
-    cls_lock_client
-    cls_journal_client
-    global)
-
-  set(rbd_srcs
-    tools/rbd/rbd.cc
-    tools/rbd/ArgumentTypes.cc
-    tools/rbd/IndentStream.cc
-    tools/rbd/OptionPrinter.cc
-    tools/rbd/Shell.cc
-    tools/rbd/Utils.cc
-    tools/rbd/action/Bench.cc
-    tools/rbd/action/Children.cc
-    tools/rbd/action/Clone.cc
-    tools/rbd/action/Copy.cc
-    tools/rbd/action/Create.cc
-    tools/rbd/action/Diff.cc
-    tools/rbd/action/DiskUsage.cc
-    tools/rbd/action/Export.cc
-    tools/rbd/action/ExportDiff.cc
-    tools/rbd/action/Feature.cc
-    tools/rbd/action/Flatten.cc
-    tools/rbd/action/Group.cc
-    tools/rbd/action/ImageMeta.cc
-    tools/rbd/action/Import.cc
-    tools/rbd/action/ImportDiff.cc
-    tools/rbd/action/Info.cc
-    tools/rbd/action/Journal.cc
-    tools/rbd/action/Kernel.cc
-    tools/rbd/action/List.cc
-    tools/rbd/action/Lock.cc
-    tools/rbd/action/MergeDiff.cc
-    tools/rbd/action/MirrorPool.cc
-    tools/rbd/action/MirrorImage.cc
-    tools/rbd/action/Nbd.cc
-    tools/rbd/action/ObjectMap.cc
-    tools/rbd/action/Remove.cc
-    tools/rbd/action/Rename.cc
-    tools/rbd/action/Resize.cc
-    tools/rbd/action/Snap.cc
-    tools/rbd/action/Status.cc
-    tools/rbd/action/Watch.cc)
-  add_executable(rbd ${rbd_srcs}
-    $<TARGET_OBJECTS:common_util_obj>
-    $<TARGET_OBJECTS:parse_secret_objs>
-    $<TARGET_OBJECTS:common_texttable_obj>
-    $<TARGET_OBJECTS:krbd_objs>)
-  set_target_properties(rbd PROPERTIES OUTPUT_NAME rbd)
-  target_link_libraries(rbd librbd librados global common keyutils udev
-    ${Boost_REGEX_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}
-    ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
-  install(TARGETS rbd rbd-nbd rbd-mirror DESTINATION bin)
   install(PROGRAMS
     ${CMAKE_SOURCE_DIR}/src/ceph-rbdnamer
     ${CMAKE_SOURCE_DIR}/src/rbd-replay-many
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
new file mode 100644 (file)
index 0000000..85a3943
--- /dev/null
@@ -0,0 +1,38 @@
+add_executable(ceph-client-debug ceph-client-debug.cc)
+target_link_libraries(ceph-client-debug cephfs librados global common)
+install(TARGETS ceph-client-debug DESTINATION bin)
+
+add_executable(ceph-kvstore-tool ceph_kvstore_tool.cc)
+target_link_libraries(ceph-kvstore-tool os global ${UNITTEST_CXX_FLAGS})
+install(TARGETS ceph-kvstore-tool DESTINATION bin)
+
+set(ceph_conf_srcs ceph_conf.cc)
+add_executable(ceph-conf ${ceph_conf_srcs})
+target_link_libraries(ceph-conf global)
+install(TARGETS ceph-conf DESTINATION bin)
+
+set(monmaptool_srcs monmaptool.cc)
+add_executable(monmaptool ${monmaptool_srcs})
+target_link_libraries(monmaptool global)
+install(TARGETS monmaptool DESTINATION bin)
+
+set(osdomaptool_srcs osdmaptool.cc)
+add_executable(osdmaptool ${osdomaptool_srcs})
+target_link_libraries(osdmaptool global)
+install(TARGETS osdmaptool DESTINATION bin)
+
+set(ceph_psim_srcs psim.cc)
+add_executable(ceph_psim ${ceph_psim_srcs})
+target_link_libraries(ceph_psim global)
+install(TARGETS ceph_psim DESTINATION bin)
+
+set(ceph_authtool_srcs ceph_authtool.cc)
+add_executable(ceph-authtool ${ceph_authtool_srcs})
+target_link_libraries(ceph-authtool global ${EXTRALIBS} ${CRYPTO_LIBS})
+install(TARGETS ceph-authtool DESTINATION bin)
+
+if(WITH_RBD)
+  add_subdirectory(rbd)
+  add_subdirectory(rbd_mirror)
+  add_subdirectory(rbd_nbd)
+endif(WITH_RBD)
diff --git a/src/tools/rbd/CMakeLists.txt b/src/tools/rbd/CMakeLists.txt
new file mode 100644 (file)
index 0000000..36c7303
--- /dev/null
@@ -0,0 +1,48 @@
+set(rbd_srcs
+  rbd.cc
+  ArgumentTypes.cc
+  IndentStream.cc
+  OptionPrinter.cc
+  Shell.cc
+  Utils.cc
+  action/Bench.cc
+  action/Children.cc
+  action/Clone.cc
+  action/Copy.cc
+  action/Create.cc
+  action/Diff.cc
+  action/DiskUsage.cc
+  action/Export.cc
+  action/ExportDiff.cc
+  action/Feature.cc
+  action/Flatten.cc
+  action/Group.cc
+  action/ImageMeta.cc
+  action/Import.cc
+  action/ImportDiff.cc
+  action/Info.cc
+  action/Journal.cc
+  action/Kernel.cc
+  action/List.cc
+  action/Lock.cc
+  action/MergeDiff.cc
+  action/MirrorPool.cc
+  action/MirrorImage.cc
+  action/Nbd.cc
+  action/ObjectMap.cc
+  action/Remove.cc
+  action/Rename.cc
+  action/Resize.cc
+  action/Snap.cc
+  action/Status.cc
+  action/Watch.cc)
+add_executable(rbd ${rbd_srcs}
+  $<TARGET_OBJECTS:common_util_obj>
+  $<TARGET_OBJECTS:parse_secret_objs>
+  $<TARGET_OBJECTS:common_texttable_obj>
+  $<TARGET_OBJECTS:krbd_objs>)
+set_target_properties(rbd PROPERTIES OUTPUT_NAME rbd)
+target_link_libraries(rbd librbd librados global common keyutils udev
+  ${Boost_REGEX_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}
+  ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
+install(TARGETS rbd DESTINATION bin)
diff --git a/src/tools/rbd_mirror/CMakeLists.txt b/src/tools/rbd_mirror/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4ac3c8c
--- /dev/null
@@ -0,0 +1,42 @@
+set(rbd_mirror_internal
+  ClusterWatcher.cc
+  ImageReplayer.cc
+  ImageDeleter.cc
+  ImageSync.cc
+  ImageSyncThrottler.cc
+  Mirror.cc
+  PoolWatcher.cc
+  Replayer.cc
+  Threads.cc
+  types.cc
+  image_replayer/BootstrapRequest.cc
+  image_replayer/CloseImageRequest.cc
+  image_replayer/CreateImageRequest.cc
+  image_replayer/OpenImageRequest.cc
+  image_replayer/OpenLocalImageRequest.cc
+  image_replayer/ReplayStatusFormatter.cc
+  image_sync/ImageCopyRequest.cc
+  image_sync/ObjectCopyRequest.cc
+  image_sync/SnapshotCopyRequest.cc
+  image_sync/SnapshotCreateRequest.cc
+  image_sync/SyncPointCreateRequest.cc
+  image_sync/SyncPointPruneRequest.cc)
+add_library(rbd_mirror_internal STATIC
+  ${rbd_mirror_internal})
+
+add_executable(rbd-mirror
+  main.cc
+  ${CMAKE_SOURCE_DIR}/src/common/ContextCompletion.cc)
+target_link_libraries(rbd-mirror
+  rbd_mirror_internal
+  rbd_internal
+  rbd_api
+  rbd_types
+  journal
+  librados
+  osdc
+  cls_rbd_client
+  cls_lock_client
+  cls_journal_client
+  global)
+install(TARGETS rbd-mirror DESTINATION bin)
diff --git a/src/tools/rbd_nbd/CMakeLists.txt b/src/tools/rbd_nbd/CMakeLists.txt
new file mode 100644 (file)
index 0000000..81a8dba
--- /dev/null
@@ -0,0 +1,5 @@
+add_executable(rbd-nbd rbd-nbd.cc
+  $<TARGET_OBJECTS:parse_secret_objs>)
+target_link_libraries(rbd-nbd librbd librados global keyutils
+  ${Boost_REGEX_LIBRARY})
+install(TARGETS rbd-nbd DESTINATION bin)