]> git.proxmox.com Git - ceph.git/blob - ceph/cmake/modules/Finddaxctl.cmake
update ceph source to reef 18.1.2
[ceph.git] / ceph / cmake / modules / Finddaxctl.cmake
1 # - Find libdaxctl
2 # Find the daxctl libraries and includes
3 #
4 # daxctl_INCLUDE_DIR - where to find libdaxctl.h etc.
5 # daxctl_LIBRARIES - List of libraries when using daxctl.
6 # daxctl_FOUND - True if daxctl found.
7
8 find_path(daxctl_INCLUDE_DIR daxctl/libdaxctl.h)
9
10 if(daxctl_INCLUDE_DIR AND EXISTS "${daxctl_INCLUDE_DIR}/libdaxctl.h")
11 foreach(ver "MAJOR" "MINOR" "RELEASE")
12 file(STRINGS "${daxctl_INCLUDE_DIR}/libdaxctl.h" daxctl_VER_${ver}_LINE
13 REGEX "^#define[ \t]+daxctl_VERSION_${ver}[ \t]+[0-9]+[ \t]+.*$")
14 string(REGEX REPLACE "^#define[ \t]+daxctl_VERSION_${ver}[ \t]+([0-9]+)[ \t]+.*$"
15 "\\1" daxctl_VERSION_${ver} "${daxctl_VER_${ver}_LINE}")
16 unset(${daxctl_VER_${ver}_LINE})
17 endforeach()
18 set(daxctl_VERSION_STRING
19 "${daxctl_VERSION_MAJOR}.${daxctl_VERSION_MINOR}.${daxctl_VERSION_RELEASE}")
20 endif()
21
22 find_library(daxctl_LIBRARY daxctl)
23
24 include(FindPackageHandleStandardArgs)
25 find_package_handle_standard_args(daxctl
26 REQUIRED_VARS daxctl_LIBRARY daxctl_INCLUDE_DIR
27 VERSION_VAR daxctl_VERSION_STRING)
28
29 mark_as_advanced(daxctl_INCLUDE_DIR daxctl_LIBRARY)
30
31 if(daxctl_FOUND)
32 set(daxctl_INCLUDE_DIRS ${daxctl_INCLUDE_DIR})
33 set(daxctl_LIBRARIES ${daxctl_LIBRARY})
34 if(NOT (TARGET daxctl::daxctl))
35 add_library(daxctl::daxctl UNKNOWN IMPORTED)
36 set_target_properties(daxctl::daxctl PROPERTIES
37 INTERFACE_INCLUDE_DIRECTORIES "${daxctl_INCLUDE_DIRS}"
38 IMPORTED_LINK_INTERFACE_LANGUAGES "C"
39 IMPORTED_LOCATION "${daxctl_LIBRARIES}"
40 VERSION "${daxctl_VERSION_STRING}")
41 endif()
42 endif()