cmake: link against libfuse if HAVE_LIBFUSE

* use ${FUSE_LIBRARIES} instead of "fuse" when referencing libfuse.
* do not compile FuseStore.cc if !HAVE_LIBFUSE.
* CMakeLists.txt: s/HAVE_FUSE/HAVE_LIBFUSE/, to match with the one
  defined for config.h.in.cmake, otherwise we need two vars:
  HAVE_LIBFUSE, and HAVE_FUSE

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2016-01-28 14:47:07 +08:00
parent fd8ab0bd07
commit 63d3d2bec7
3 changed files with 17 additions and 8 deletions

View File

@ -126,7 +126,7 @@ endif(${WITH_AIO})
option(WITH_FUSE "Fuse is here" ON)
if(${WITH_FUSE})
find_package(fuse)
set(HAVE_FUSE ${FUSE_FOUND})
set(HAVE_LIBFUSE ${FUSE_FOUND})
CHECK_FUNCTION_EXISTS(fuse_getgroups HAVE_FUSE_GETGROUPS)
endif(${WITH_FUSE})

View File

@ -626,7 +626,6 @@ if(${HAVE_XFS})
os/fs/XFS.cc)
endif(${HAVE_XFS})
set(libos_srcs
os/FuseStore.cc
os/ObjectStore.cc
os/Transaction.cc
os/filestore/chain_xattr.cc
@ -656,6 +655,10 @@ set(libos_srcs
os/bluestore/StupidAllocator.cc
os/fs/FS.cc
${libos_xfs_srcs})
if(${HAVE_LIBFUSE})
list(APPEND libos_srcs
os/FuseStore.cc)
endif(${HAVE_LIBFUSE})
# make rocksdb statically
add_custom_target(build_rocksdb
@ -679,6 +682,9 @@ endif(${HAVE_LIBAIO})
if(${WITH_LTTNG})
target_link_libraries(os libos_tp)
endif(${WITH_LTTNG})
if(${HAVE_LIBFUSE})
target_link_libraries(os ${FUSE_LIBRARIES})
endif(${HAVE_LIBFUSE})
target_link_libraries(os kv)
set(cls_references_files objclass/class_api.cc)
@ -728,7 +734,10 @@ add_executable(ceph-osd ${ceph_osd_srcs}
$<TARGET_OBJECTS:heap_profiler_objs>
$<TARGET_OBJECTS:common_util_obj>)
add_dependencies(ceph-osd erasure_code_plugins)
target_link_libraries(ceph-osd osd os global ${BLKID_LIBRARIES} ${ALLOC_LIBS} fuse)
target_link_libraries(ceph-osd osd os global ${BLKID_LIBRARIES} ${ALLOC_LIBS})
if(${HAVE_LIBFUSE})
target_link_libraries(ceph-osd ${FUSE_LIBRARIES})
endif(${HAVE_LIBFUSE})
install(TARGETS ceph-osd DESTINATION bin)
# MDS
@ -928,15 +937,15 @@ endif(${ENABLE_SHARED})
install(TARGETS ceph-syn DESTINATION bin)
install(TARGETS mount.ceph DESTINATION sbin)
if(HAVE_FUSE)
if(HAVE_LIBFUSE)
set(ceph_fuse_srcs
ceph_fuse.cc
client/fuse_ll.cc)
add_executable(ceph-fuse ${ceph_fuse_srcs})
target_link_libraries(ceph-fuse fuse client global)
target_link_libraries(ceph-fuse ${FUSE_LIBRARIES} client global)
set_target_properties(ceph-fuse PROPERTIES COMPILE_FLAGS "-I${FUSE_INCLUDE_DIRS}")
install(TARGETS ceph-fuse DESTINATION bin)
endif(HAVE_FUSE)
endif(HAVE_LIBFUSE)
endif(WITH_LIBCEPHFS)
set(journal_srcs

View File

@ -2335,7 +2335,7 @@ target_link_libraries(test_keyvaluedb_iterators
${CMAKE_DL_LIBS}
)
if(${HAVE_FUSE})
if(${HAVE_LIBFUSE})
add_executable(test_cfuse_cache_invalidate
test_cfuse_cache_invalidate.cc
)
@ -2346,7 +2346,7 @@ if(${HAVE_FUSE})
${ALLOC_LIBS}
${CMAKE_DL_LIBS}
)
endif(${HAVE_FUSE})
endif(${HAVE_LIBFUSE})
if(${WITH_CEPHFS})
add_executable(test_c_headers