From 65c4a7f1ce5a1584d1630206f94a5dc1f0e4f817 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 4 Dec 2023 14:26:35 -0500 Subject: [PATCH] cmake: ensure WITH_AIO=0 and WITH_IIOD_USBD=1 fails at cmake time, not at link time. Turns this: /usr/bin/ld: CMakeFiles/iiod.dir/iiod.c.o: in function `main': /home/benja/git/libiio/iiod/iiod.c:531: undefined reference to `start_usb_daemon' [100%] Built target iio_stresstest collect2: error: ld returned 1 exit status make[2]: *** [iiod/CMakeFiles/iiod.dir/build.make:227: iiod/iiod] Error 1 make[1]: *** [CMakeFiles/Makefile2:466: iiod/CMakeFiles/iiod.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [100%] Built target iio_attr make: *** [Makefile:136: all] Error 2 into this: CMake Error at iiod/CMakeLists.txt:72 (message): Sorry, USB support in iiod (WITH_IIOD_USBD) requires async I/O support (WITH_AIO) should resolve #984 Signed-off-by: Robin Getz --- iiod/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iiod/CMakeLists.txt b/iiod/CMakeLists.txt index 88235b4d0..c1ecde4e6 100644 --- a/iiod/CMakeLists.txt +++ b/iiod/CMakeLists.txt @@ -68,6 +68,9 @@ if (WITH_AIO) target_include_directories(iiod PRIVATE ${LIBAIO_INCLUDE_DIR}) target_link_libraries(iiod LINK_PRIVATE ${LIBAIO_LIBRARIES}) +elseif (WITH_IIOD_USBD) + message(SEND_ERROR "Sorry, USB support in iiod (WITH_IIOD_USBD)" + " requires async I/O support (WITH_AIO)") endif() option(WITH_IIOD_SERIAL "Add serial (UART) support" ON)