summaryrefslogtreecommitdiff
path: root/tpool
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2021-03-23 09:41:50 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2021-03-23 17:20:17 +0100
commitcb545f11169d2425316d96feafc78ac841950e43 (patch)
tree21e6a3306269be537e21a69321c30cab6d36776e /tpool
parent2e31b2ffe9b443b029e51961ef6b0617df380388 (diff)
downloadmariadb-git-cb545f11169d2425316d96feafc78ac841950e43.tar.gz
CMake cleanup
- use FIND_PACKAGE(LIBAIO) to find libaio - Use standard CMake conventions in Find{PMEM,URING}.cmake - Drop the LIB from LIB{PMEM,URING}_{INCLUDE_DIR,LIBRARIES} It is cleaner, and consistent with how other packages are handled in CMake. e.g successful FIND_PACKAGE(PMEM) now sets PMEM_FOUND, PMEM_LIBRARIES, PMEM_INCLUDE_DIR, not LIBPMEM_{FOUND,LIBRARIES,INCLUDE_DIR}. - Decrease the output. use FIND_PACKAGE with QUIET argument. - for Linux packages, either liburing, or libaio is required If liburing is installed, libaio does not need to be present . Use FIND_PACKAGE([LIBAIO|URING] REQUIRED) if either library is required.
Diffstat (limited to 'tpool')
-rw-r--r--tpool/CMakeLists.txt23
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()