]> git.proxmox.com Git - ceph.git/blame - ceph/src/seastar/cmake/FindLibUring.cmake
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / seastar / cmake / FindLibUring.cmake
CommitLineData
1e59de90
TL
1#
2# This file is open source software, licensed to you under the terms
3# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4# distributed with this work for additional information regarding copyright
5# ownership. You may not use this file except in compliance with the License.
6#
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing,
12# software distributed under the License is distributed on an
13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14# KIND, either express or implied. See the License for the
15# specific language governing permissions and limitations
16# under the License.
17#
18
19#
20# Copyright (C) 2022 ScyllaDB
21#
22
23find_package (PkgConfig REQUIRED)
24
25pkg_check_modules (PC_URING QUIET liburing)
26
27find_library (URING_LIBRARY
28 NAMES uring
29 HINTS
30 ${PC_URING_LIBDIR}
31 ${PC_URING_LIBRARY_DIRS})
32
33find_path (URING_INCLUDE_DIR
34 NAMES liburing.h
35 HINTS
36 ${PC_URING_INCLUDEDIR}
37 ${PC_URING_INCLUDE_DIRS})
38
39if (URING_INCLUDE_DIR)
40 include (CheckStructHasMember)
41 include (CMakePushCheckState)
42 cmake_push_check_state (RESET)
43 list(APPEND CMAKE_REQUIRED_INCLUDES ${URING_INCLUDE_DIR})
44 CHECK_STRUCT_HAS_MEMBER ("struct io_uring" features liburing.h
45 HAVE_IOURING_FEATURES LANGUAGE CXX)
46 cmake_pop_check_state ()
47endif ()
48
49mark_as_advanced (
50 URING_LIBRARY
51 URING_INCLUDE_DIR
52 HAVE_IOURING_FEATURES)
53
54include (FindPackageHandleStandardArgs)
55
56find_package_handle_standard_args (LibUring
57 REQUIRED_VARS
58 URING_LIBRARY
59 URING_INCLUDE_DIR
60 HAVE_IOURING_FEATURES
61 VERSION_VAR PC_URING_VERSION)
62
63if (LibUring_FOUND)
64 set (URING_LIBRARIES ${URING_LIBRARY})
65 set (URING_INCLUDE_DIRS ${URING_INCLUDE_DIR})
66 if (NOT (TARGET URING::uring))
67 add_library (URING::uring UNKNOWN IMPORTED)
68
69 set_target_properties (URING::uring
70 PROPERTIES
71 IMPORTED_LOCATION ${URING_LIBRARY}
72 INTERFACE_INCLUDE_DIRECTORIES ${URING_INCLUDE_DIRS})
73 endif ()
74endif ()