]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: link against FUSE::FUSE
authorKefu Chai <kchai@redhat.com>
Fri, 17 Apr 2020 05:46:21 +0000 (13:46 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 17 Apr 2020 06:10:55 +0000 (14:10 +0800)
instead of specifying the include directory and linkage separately

Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/FindFUSE.cmake
src/CMakeLists.txt
src/os/CMakeLists.txt
src/rbd_fuse/CMakeLists.txt
src/tools/CMakeLists.txt

index 58c50cb9808e340bb7a49a51fcebc2cc9e8489d4..73fef22d7b3b73b648c2c5ce4b878e580cda47d4 100644 (file)
@@ -26,3 +26,14 @@ find_package_handle_standard_args(FUSE DEFAULT_MSG
 
 mark_as_advanced(
   FUSE_INCLUDE_DIRS FUSE_LIBRARIES)
+
+if(FUSE_FOUND)
+  if(NOT TARGET FUSE::FUSE)
+    add_library(FUSE::FUSE UNKNOWN IMPORTED)
+    set_target_properties(FUSE::FUSE PROPERTIES
+      INTERFACE_INCLUDE_DIRECTORIES "${FUSE_INCLUDE_DIRS}"
+      IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      IMPORTED_LOCATION "${FUSE_LIBRARIES}"
+      VERSION "${FUSE_VERSION}")
+  endif()
+endif()
index 23fc2b80d916ba64b88816a1027c850ea2a436ed..b77f77c9c6acf3d27185c92cfc2b7d3d772295cc 100644 (file)
@@ -552,7 +552,7 @@ add_dependencies(ceph-osd erasure_code_plugins)
 target_link_libraries(ceph-osd osd os global-static common
   ${BLKID_LIBRARIES})
 if(WITH_FUSE)
-  target_link_libraries(ceph-osd ${FUSE_LIBRARIES})
+  target_link_libraries(ceph-osd FUSE::FUSE)
 endif()
 set_target_properties(ceph-osd PROPERTIES
   POSITION_INDEPENDENT_CODE ${EXE_LINKER_USE_PIE}
@@ -705,10 +705,9 @@ if(WITH_FUSE)
     ceph_fuse.cc
     client/fuse_ll.cc)
   add_executable(ceph-fuse ${ceph_fuse_srcs})
-  target_link_libraries(ceph-fuse ${FUSE_LIBRARIES}
+  target_link_libraries(ceph-fuse FUSE::FUSE
     ${GSSAPI_LIBRARIES} client ceph-common global-static ${EXTRALIBS})
   set_target_properties(ceph-fuse PROPERTIES
-    COMPILE_FLAGS "-I${FUSE_INCLUDE_DIRS}"
     POSITION_INDEPENDENT_CODE ${EXE_LINKER_USE_PIE})
   install(TARGETS ceph-fuse DESTINATION bin)
   install(PROGRAMS mount.fuse.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
index 3eb03cbe9e81e90b52f700ed94a937369f25b9f8..760244b9b435c8ca756e9aa28e0a68c45000cb94 100644 (file)
@@ -93,8 +93,7 @@ if(HAVE_LIBAIO)
 endif(HAVE_LIBAIO)
 
 if(WITH_FUSE)
-  target_include_directories(os SYSTEM PRIVATE ${FUSE_INCLUDE_DIRS})
-  target_link_libraries(os ${FUSE_LIBRARIES})
+  target_link_libraries(os FUSE::FUSE)
 endif()
 
 if(HAVE_LIBZFS)
index e0bd3e2497d15eb21ae3341f3ab30863a353d0ca..f83f97a3f7da9c07c89798f39abd38d135d75a8e 100644 (file)
@@ -1,5 +1,5 @@
 add_executable(rbd-fuse
   rbd-fuse.cc)
 target_link_libraries(rbd-fuse
-  ceph-common librbd librados global ${FUSE_LIBRARIES})
+  ceph-common librbd librados global FUSE::FUSE)
 install(TARGETS rbd-fuse DESTINATION bin)
index 0f8120a777522293aa2c55304e7731dda6cd93a1..8cccf208dfde84f8637cfcfe2f80d19f359ca1b5 100644 (file)
@@ -50,7 +50,7 @@ add_executable(ceph-objectstore-tool
   RadosDump.cc)
 target_link_libraries(ceph-objectstore-tool osd os global Boost::program_options ${CMAKE_DL_LIBS})
 if(WITH_FUSE)
-  target_link_libraries(ceph-objectstore-tool ${FUSE_LIBRARIES})
+  target_link_libraries(ceph-objectstore-tool FUSE::FUSE)
 endif(WITH_FUSE)
 install(TARGETS ceph-objectstore-tool DESTINATION bin)