From 346fd43bf80c9d65feccd664c7e054da55f6cb58 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 20 Nov 2017 12:55:54 +0800 Subject: [PATCH] cmake: complain if spdk/pmem is enabled w/o bluestore and complain if bluestore is enabled w/o any backend found. Signed-off-by: Kefu Chai --- CMakeLists.txt | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88705940f24..36e97bf6da5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,12 +185,6 @@ else() message(STATUS "Not using BLKID") endif(LINUX) -option(WITH_BLUESTORE "Bluestore OSD backend" ON) -if(WITH_BLUESTORE) - find_package(aio) - set(HAVE_LIBAIO ${AIO_FOUND}) -endif() - option(WITH_OPENLDAP "OPENLDAP is here" ON) if(WITH_OPENLDAP) find_package(OpenLdap REQUIRED) @@ -215,20 +209,40 @@ if(WITH_ZFS) set(HAVE_LIBZFS ${ZFS_FOUND}) endif() +option(WITH_BLUESTORE "Bluestore OSD backend" ON) +if(WITH_BLUESTORE) + find_package(aio) + set(HAVE_LIBAIO ${AIO_FOUND}) +endif() + if(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|amd64|x86_64|AMD64") option(WITH_SPDK "Enable SPDK" ON) else() option(WITH_SPDK "Enable SPDK" OFF) endif() if(WITH_SPDK) + if(NOT WITH_BLUESTORE) + message(SEND_ERROR "Please enable WITH_BLUESTORE for using SPDK") + endif() include(BuildSPDK) build_spdk() set(HAVE_SPDK TRUE) endif(WITH_SPDK) option(WITH_PMEM "Enable PMEM" OFF) -if (WITH_PMEM) +if(WITH_PMEM) set(HAVE_PMEM ON) + if(NOT WITH_BLUESTORE) + message(SEND_ERROR "Please enable WITH_BLUESTORE for using PMEM") + endif() +endif() + +if(WITH_BLUESTORE) + if(NOT AIO_FOUND AND NOT WITH_SPDK AND NOT WITH_PMEM) + message(SEND_ERROR "WITH_BLUESTORE is ON, " + "but none of the bluestore backends is enabled. " + "Please install libaio, or enable WITH_SPDK or WITH_PMEM (experimental)") + endif() endif() option(WITH_BLUEFS "libbluefs library" OFF) -- 2.39.5