summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2018-07-27 19:51:20 +0200
committerKefu Chai <kchai@redhat.com>2018-07-28 10:53:10 +0200
commit7dd82bbeb149c75e3f7b936f16144194405bfd7d (patch)
tree3133fa76564611929ed08a1e3be4b4c859c2c44e
parentcmake: extract Yasm check into a module (diff)
downloadceph-7dd82bbeb149c75e3f7b936f16144194405bfd7d.tar.xz
ceph-7dd82bbeb149c75e3f7b936f16144194405bfd7d.zip
cmake: extract mount.ceph into src/mount
Signed-off-by: Kefu Chai <kchai@redhat.com>
-rw-r--r--cmake/modules/Findkeyutils.cmake22
-rw-r--r--src/CMakeLists.txt14
-rw-r--r--src/mount/CMakeLists.txt9
3 files changed, 22 insertions, 23 deletions
diff --git a/cmake/modules/Findkeyutils.cmake b/cmake/modules/Findkeyutils.cmake
index e34be8b5eb4..d88bc078234 100644
--- a/cmake/modules/Findkeyutils.cmake
+++ b/cmake/modules/Findkeyutils.cmake
@@ -5,23 +5,23 @@
# KEYUTILS_INCLUDE_DIR - the keyutils include directories
# KEYUTILS_LIBRARIES - link these to use keyutils
-if(KEYUTILS_INCLUDE_DIR AND KEYUTILS_LIBRARIES)
- set(KEYUTILS_FIND_QUIETLY TRUE)
-endif(KEYUTILS_INCLUDE_DIR AND KEYUTILS_LIBRARIES)
-
-# include dir
find_path(KEYUTILS_INCLUDE_DIR keyutils.h PATHS
/opt/local/include
/usr/local/include
)
-# finally the library itself
-find_library(LIBKEYUTILS NAMES keyutils)
-set(KEYUTILS_LIBRARIES ${LIBKEYUTILS})
+find_library(KEYUTILS_LIBRARIES NAMES keyutils)
-# handle the QUIETLY and REQUIRED arguments and set KEYUTILS_FOUND to TRUE if
-# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(keyutils DEFAULT_MSG KEYUTILS_LIBRARIES KEYUTILS_INCLUDE_DIR)
+find_package_handle_standard_args(keyutils
+ DEFAULT_MSG KEYUTILS_LIBRARIES KEYUTILS_INCLUDE_DIR)
mark_as_advanced(KEYUTILS_LIBRARIES KEYUTILS_INCLUDE_DIR)
+
+if(KEYUTILS_FOUND AND NOT (TARGET keyutils::keyutils))
+ add_library(keyutils::keyutils UNKNOWN IMPORTED)
+ set_target_properties(keyutils::keyutils PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${KEYUTILS_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${KEYUTILS_LIBRARIES}")
+endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b3c0a5ef1a8..292b0d9404b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -636,18 +636,8 @@ if(WITH_LIBCEPHFS)
client/SyntheticClient.cc)
add_executable(ceph-syn ${ceph_syn_srcs})
target_link_libraries(ceph-syn client global-static ceph-common)
-
- set(mount_ceph_srcs
- mount/mount.ceph.c)
- add_executable(mount.ceph ${mount_ceph_srcs}
- $<TARGET_OBJECTS:parse_secret_objs>
- $<TARGET_OBJECTS:common_mountcephfs_objs>)
- set_target_properties(mount.ceph PROPERTIES
- INSTALL_RPATH "")
- target_link_libraries(mount.ceph ${KEYUTILS_LIBRARIES})
-
install(TARGETS ceph-syn DESTINATION bin)
- install(TARGETS mount.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
+ add_subdirectory(mount)
endif(WITH_LIBCEPHFS)
if(WITH_FUSE)
@@ -668,7 +658,7 @@ if(WITH_RBD)
if(WITH_KRBD)
add_library(krbd STATIC krbd.cc
$<TARGET_OBJECTS:parse_secret_objs>)
- target_link_libraries(krbd ${KEYUTILS_LIBRARIES})
+ target_link_libraries(krbd keyutils::keyutils)
endif()
add_subdirectory(librbd)
if(WITH_FUSE)
diff --git a/src/mount/CMakeLists.txt b/src/mount/CMakeLists.txt
new file mode 100644
index 00000000000..6ff26174461
--- /dev/null
+++ b/src/mount/CMakeLists.txt
@@ -0,0 +1,9 @@
+set(mount_ceph_srcs
+ mount.ceph.c)
+add_executable(mount.ceph ${mount_ceph_srcs}
+ $<TARGET_OBJECTS:parse_secret_objs>
+ $<TARGET_OBJECTS:common_mountcephfs_objs>)
+set_target_properties(mount.ceph PROPERTIES
+ INSTALL_RPATH "")
+target_link_libraries(mount.ceph keyutils::keyutils)
+install(TARGETS mount.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})