diff options
Diffstat (limited to 'tpool')
-rw-r--r-- | tpool/CMakeLists.txt | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tpool/CMakeLists.txt b/tpool/CMakeLists.txt index 213cef7b5de..69440d09490 100644 --- a/tpool/CMakeLists.txt +++ b/tpool/CMakeLists.txt @@ -3,24 +3,27 @@ IF(WIN32) SET(EXTRA_SOURCES tpool_win.cc aio_win.cc) ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") OPTION(WITH_URING "Require that io_uring be used" OFF) - FIND_PACKAGE(URING) + OPTION(WITH_LIBAIO "Require that libaio is used, unless uring is there" OFF) + IF(WITH_URING) + SET(URING_REQUIRED REQUIRED) + ELSEIF(WITH_LIBAIO) + SET(LIBAIO_REQIRED REQUIRED) + ENDIF() + FIND_PACKAGE(URING QUIET ${URING_REQUIRED}) IF(URING_FOUND) SET(URING_FOUND ${URING_FOUND} PARENT_SCOPE) SET(TPOOL_DEFINES "-DHAVE_URING" PARENT_SCOPE) ADD_DEFINITIONS(-DHAVE_URING) - LINK_LIBRARIES(${LIBURING_LIBRARIES}) - INCLUDE_DIRECTORIES(${LIBURING_INCLUDE_DIR}) + LINK_LIBRARIES(${URING_LIBRARIES}) + INCLUDE_DIRECTORIES(${URING_INCLUDE_DIR}) SET(EXTRA_SOURCES aio_liburing.cc) ELSE() - IF(WITH_URING) - MESSAGE(FATAL_ERROR "WITH_URING=ON cannot be satisfied") - ENDIF() - CHECK_INCLUDE_FILES (libaio.h HAVE_LIBAIO_H) - CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO) - IF(HAVE_LIBAIO_H AND HAVE_LIBAIO) + FIND_PACKAGE(LIBAIO QUIET ${LIBAIO_REQUIRED}) + IF(LIBAIO_FOUND) SET(TPOOL_DEFINES "-DLINUX_NATIVE_AIO" PARENT_SCOPE) ADD_DEFINITIONS(-DLINUX_NATIVE_AIO) - LINK_LIBRARIES(aio) + INCLUDE_DIRECTORIES(${LIBAIO_INCLUDE_DIR}) + LINK_LIBRARIES(${LIBAIO_LIBRARIES}) SET(EXTRA_SOURCES aio_linux.cc) ENDIF() ENDIF() |