Skip to content

Commit

Permalink
cmake: ensure WITH_AIO=0 and WITH_IIOD_USBD=1 fails
Browse files Browse the repository at this point in the history
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 analogdevicesinc#984

Signed-off-by: Robin Getz <rgetz@mathworks.com>
  • Loading branch information
rgetz committed Dec 4, 2023
1 parent 6d232f2 commit 65c4a7f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions iiod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 65c4a7f

Please sign in to comment.