From: Kefu Chai Date: Fri, 17 Apr 2020 05:46:21 +0000 (+0800) Subject: cmake: link against FUSE::FUSE X-Git-Tag: v15.2.2~12^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f806447e26555e18ee4a128ea30aa5011829150b;p=ceph.git cmake: link against FUSE::FUSE instead of specifying the include directory and linkage separately Signed-off-by: Kefu Chai (cherry picked from commit b823952d245db4967828033003729a643d8e276f) --- diff --git a/cmake/modules/FindFUSE.cmake b/cmake/modules/FindFUSE.cmake index 58c50cb9808..73fef22d7b3 100644 --- a/cmake/modules/FindFUSE.cmake +++ b/cmake/modules/FindFUSE.cmake @@ -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() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5f370b8dbbb..bb4a7812d1b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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}) diff --git a/src/os/CMakeLists.txt b/src/os/CMakeLists.txt index 51894fd9a3c..c950ed9b85a 100644 --- a/src/os/CMakeLists.txt +++ b/src/os/CMakeLists.txt @@ -92,8 +92,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) diff --git a/src/rbd_fuse/CMakeLists.txt b/src/rbd_fuse/CMakeLists.txt index e0bd3e2497d..f83f97a3f7d 100644 --- a/src/rbd_fuse/CMakeLists.txt +++ b/src/rbd_fuse/CMakeLists.txt @@ -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) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 0f8120a7775..8cccf208dfd 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -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)