From: Max Kellermann Date: Mon, 14 Oct 2024 19:21:58 +0000 (+0200) Subject: blk/CMakeLists.txt: generate interface library if `libblk` is disabled X-Git-Tag: testing/wip-pdonnell-testing-20250214.031850-debug~14^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=19b406f8d24dc4ca6ed11beaffe26174933e2501;p=ceph-ci.git blk/CMakeLists.txt: generate interface library if `libblk` is disabled If all the libraries which `libblk` wraps (i.e. Bluestore, AIO, SPDK, ZBD) are disabled, then the build aborts with a linker failure: ``` c++ [...] -o bin/ceph-mon [...] -lblk [...] mold: fatal: library not found: blk collect2: error: ld returned 1 exit status ``` This is because `blk` is used (via `os`) but if the `add_library()` directive is skipped, `cmake` attempts to look up a library with that name. Signed-off-by: Max Kellermann --- diff --git a/src/blk/CMakeLists.txt b/src/blk/CMakeLists.txt index 62c2a5c29f4..6a4ebd502b9 100644 --- a/src/blk/CMakeLists.txt +++ b/src/blk/CMakeLists.txt @@ -23,6 +23,8 @@ endif() if(libblk_srcs) add_library(blk STATIC ${libblk_srcs}) target_include_directories(blk PRIVATE "./") +else() + add_library(blk INTERFACE) endif() if(HAVE_LIBAIO)