cmake: Allow cephfs and ceph-mds to be build when building on FreeBSD

on FreeBSD keyutil absence prevents building KRBD and mount.
But on FreeBSD icephfs, ceph-fuse and ceph-mds do work, so we need
ceph-mds to be build.

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
This commit is contained in:
Willem Jan Withagen 2019-09-20 16:02:23 +02:00
parent 878178f2b4
commit f698f3c3ee
4 changed files with 17 additions and 8 deletions

View File

@ -132,10 +132,13 @@ if(LINUX)
set(HAVE_UDEV ${UDEV_FOUND})
find_package(blkid REQUIRED)
set(HAVE_BLKID ${BLKID_FOUND})
find_package(keyutils REQUIRED)
set(HAVE_KEYUTILS ${KEYUTILS_FOUND})
elseif(FREEBSD)
set(HAVE_UDEV OFF)
set(HAVE_LIBAIO OFF)
set(HAVE_BLKID OFF)
set(HAVE_KEYUTILS OFF)
else()
set(HAVE_UDEV OFF)
set(HAVE_BLKID OFF)
@ -231,6 +234,13 @@ option(WITH_KRBD "Enable Linux krbd support of 'rbd' utility" ON)
if(WITH_KRBD AND NOT WITH_RBD)
message(FATAL_ERROR "Cannot have WITH_KRBD without WITH_RBD.")
endif()
if(LINUX)
if(WITH_LIBCEPHFS OR WITH_KRBD)
# keyutils is only used when talking to the Linux Kernel key store
find_package(keyutils REQUIRED)
set(HAVE_KEYUTILS ${KEYUTILS_FOUND})
endif()
endif()
option(WITH_LEVELDB "LevelDB is here" ON)
if(WITH_LEVELDB)
@ -301,10 +311,6 @@ if (HAVE_LIBTCMALLOC AND TCMALLOC_VERSION_STRING VERSION_LESS 2.6.2)
set(LIBTCMALLOC_MISSING_ALIGNED_ALLOC ON)
endif()
if(WITH_LIBCEPHFS OR WITH_KRBD)
find_package(keyutils REQUIRED)
endif()
find_package(CURL REQUIRED)
set(CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${CURL_LIBRARIES})

View File

@ -640,8 +640,6 @@ add_subdirectory(bash_completion)
add_subdirectory(client)
if(WITH_LIBCEPHFS)
find_package(PkgConfig QUIET REQUIRED)
pkg_check_modules(CAPNG REQUIRED libcap-ng)
set(libcephfs_srcs libcephfs.cc)
add_library(cephfs ${CEPH_SHARED} ${libcephfs_srcs})
target_link_libraries(cephfs PRIVATE client ceph-common
@ -668,7 +666,9 @@ if(WITH_LIBCEPHFS)
add_executable(ceph-syn ${ceph_syn_srcs})
target_link_libraries(ceph-syn client global-static ceph-common)
install(TARGETS ceph-syn DESTINATION bin)
add_subdirectory(mount)
if(LINUX)
add_subdirectory(mount)
endif()
endif(WITH_LIBCEPHFS)
if(WITH_FUSE)

View File

@ -177,7 +177,7 @@ target_link_libraries(crc32
add_library(common_utf8 STATIC utf8.c)
if(WITH_LIBCEPHFS OR WITH_KRBD)
if(HAVE_KEYUTILS)
set(parse_secret_srcs
secret.c)
add_library(parse_secret_objs OBJECT ${parse_secret_srcs})

View File

@ -1,3 +1,6 @@
find_package(PkgConfig QUIET REQUIRED)
pkg_check_modules(CAPNG REQUIRED libcap-ng)
set(mount_ceph_srcs
mount.ceph.c conf.cc)
add_executable(mount.ceph ${mount_ceph_srcs}