]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: extract mount.ceph into src/mount
authorKefu Chai <kchai@redhat.com>
Fri, 27 Jul 2018 17:51:20 +0000 (01:51 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 28 Jul 2018 08:53:10 +0000 (16:53 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/Findkeyutils.cmake
src/CMakeLists.txt
src/mount/CMakeLists.txt [new file with mode: 0644]

index e34be8b5eb4490e203e74069e50da977e005953f..d88bc0782342a02b9fa082a419ef4f111293e791 100644 (file)
@@ -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()
index b3c0a5ef1a8408e06e077342d79e1f797fd126ea..292b0d9404b3c1c4eb730d8c700f73f9696ca32b 100644 (file)
@@ -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 (file)
index 0000000..6ff2617
--- /dev/null
@@ -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})