From 78c04b1c0866635d2eb5e4cc5d1147d2d73be841 Mon Sep 17 00:00:00 2001 From: Willem Jan Withagen Date: Thu, 5 Jan 2017 11:59:42 +0100 Subject: [PATCH] CMakeLists.txt: Introduce WITH_KBRD for kernel RBD Signed-off-by: Willem Jan Withagen --- CMakeLists.txt | 9 ++++++++- src/CMakeLists.txt | 20 +++++++++++++------- src/librbd/CMakeLists.txt | 4 ++++ src/tools/CMakeLists.txt | 4 +++- src/tools/rbd/CMakeLists.txt | 6 +++++- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 898e4abdbc5f9..b202893a79ec0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,6 +232,13 @@ option(WITH_KVS "Key value store is here" ON) # remote block storage option(WITH_RBD "Remote block storage is here" ON) +# KERNEL remote block storage +option(WITH_KRBD "Kernel Remote block storage is here" ON) + +if(WITH_KRBD AND WITHOUT_RBD) + message(FATAL_ERROR "Cannot have WITH_KRBD with WITH_RBD.") +endif() + # embedded ceph daemon static library # NOTE: Ceph is mostly LGPL (see COPYING), which means that # static linking brings with it restrictions. Please be sure @@ -288,7 +295,7 @@ if(NOT JEMALLOC_FOUND) CHECK_FUNCTION_EXISTS(mallinfo HAVE_MALLINFO) endif() -if(WITH_LIBCEPHFS OR WITH_RBD) +if(WITH_LIBCEPHFS OR WITH_KRBD) find_package(keyutils REQUIRED) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 409981e575d17..02f617780c6c3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -664,9 +664,13 @@ if(WITH_RBD) set(DENCODER_EXTRALIBS ${DENCODER_EXTRALIBS} cls_rbd_client - krbd rbd_types rbd_replay_types) + if(WITH_KRBD) + set(DENCODER_EXTRALIBS + ${DENCODER_EXTRALIBS} + krbd) + endif() endif(WITH_RBD) add_executable(ceph-dencoder ${dencoder_srcs}) @@ -850,7 +854,7 @@ install(PROGRAMS add_subdirectory(bash_completion) -if(WITH_LIBCEPHFS OR WITH_RBD) +if(WITH_LIBCEPHFS OR WITH_KRBD) set(parse_secret_files common/secret.c) add_library(parse_secret_objs OBJECT ${parse_secret_files}) @@ -906,10 +910,12 @@ endif(WITH_LIBCEPHFS) add_subdirectory(journal) -if(${WITH_RBD}) - add_library(krbd STATIC krbd.cc - $) - target_link_libraries(krbd ${KEYUTILS_LIBRARIES} ${UDEV_LIBRARIES}) +if(WITH_RBD) + if(WITH_KRBD) + add_library(krbd STATIC krbd.cc + $) + target_link_libraries(krbd ${KEYUTILS_LIBRARIES} ${UDEV_LIBRARIES}) + endif() add_subdirectory(librbd) if(WITH_FUSE) add_subdirectory(rbd_fuse) @@ -921,7 +927,7 @@ if(${WITH_RBD}) ${CMAKE_SOURCE_DIR}/src/rbdmap DESTINATION ${CMAKE_INSTALL_BINDIR}) add_subdirectory(rbd_replay) -endif(${WITH_RBD}) +endif(WITH_RBD) # RadosGW if(WITH_KVS) diff --git a/src/librbd/CMakeLists.txt b/src/librbd/CMakeLists.txt index 4c9b2731cf8a4..0b224ce15dff9 100644 --- a/src/librbd/CMakeLists.txt +++ b/src/librbd/CMakeLists.txt @@ -116,6 +116,10 @@ target_link_libraries(librbd LINK_PRIVATE pthread ${CMAKE_DL_LIBS} ${EXTRALIBS}) +if(HAVE_UDEV) + target_link_libraries(librbd LINK_PRIVATE + udev) +endif() if(ENABLE_SHARED) set_target_properties(librbd PROPERTIES OUTPUT_NAME rbd diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 0d53ca6cd645e..f6336fa594f2f 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -97,5 +97,7 @@ endif(WITH_CEPHFS) if(WITH_RBD) add_subdirectory(rbd) add_subdirectory(rbd_mirror) - add_subdirectory(rbd_nbd) + if(LINUX) + add_subdirectory(rbd_nbd) + endif() endif(WITH_RBD) diff --git a/src/tools/rbd/CMakeLists.txt b/src/tools/rbd/CMakeLists.txt index 7b1c9dc706801..fea7b7b50868b 100644 --- a/src/tools/rbd/CMakeLists.txt +++ b/src/tools/rbd/CMakeLists.txt @@ -42,10 +42,14 @@ add_executable(rbd ${rbd_srcs} set_target_properties(rbd PROPERTIES OUTPUT_NAME rbd) target_link_libraries(rbd librbd librados cls_journal_client cls_rbd_client - krbd rbd_types journal ceph-common global ${Boost_REGEX_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS}) +if(WITH_KRBD) + target_link_libraries(rbd + krbd) +endif() + install(TARGETS rbd DESTINATION bin) -- 2.39.5