This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Findlmdb.cmake
108 lines (87 loc) · 2.11 KB
/
Findlmdb.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Findlmdb
-------
Finds the lmdb library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``lmdb``
The lmdb library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``LMDB_FOUND``
True if the system has the lmdb library.
``LMDB_VERSION``
The version of the lmdb library which was found.
``LMDB_INCLUDE_DIRS``
Include directories needed to use lmdb.
``LMDB_LIBRARIES``
Libraries needed to link to lmdb.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``LMDB_INCLUDE_DIR``
The directory containing ``lmdb.h``.
``LMDB_LIBRARY``
The path to the lmdb library.
#]=======================================================================]
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(
PC_lmdb
QUIET
"liblmdb"
)
if(NOT PC_LMDB_FOUND)
pkg_check_modules(
PC_lmdb
QUIET
"lmdb"
)
endif(NOT PC_LMDB_FOUND)
endif()
find_path(
LMDB_INCLUDE_DIR
NAMES lmdb.h
PATHS ${PC_lmdb_INCLUDE_DIRS}
)
find_library(
LMDB_LIBRARY
NAMES liblmdb lmdb
PATHS ${PC_lmdb_LIBRARY_DIRS}
)
set(LMDB_VERSION ${PC_lmdb_VERSION})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
${CMAKE_FIND_PACKAGE_NAME}
FOUND_VAR LMDB_FOUND
REQUIRED_VARS LMDB_LIBRARY LMDB_INCLUDE_DIR
VERSION_VAR LMDB_VERSION
)
if(LMDB_FOUND)
set(LMDB_LIBRARIES ${LMDB_LIBRARY})
set(LMDB_INCLUDE_DIRS ${LMDB_INCLUDE_DIR})
set(LMDB_DEFINITIONS ${PC_lmdb_CFLAGS_OTHER})
endif()
if(LMDB_FOUND
AND NOT
TARGET
lmdb
)
add_library(
lmdb
UNKNOWN
IMPORTED
)
set_target_properties(
lmdb
PROPERTIES
IMPORTED_LOCATION "${LMDB_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_lmdb_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${LMDB_INCLUDE_DIR}"
)
endif()
mark_as_advanced(LMDB_INCLUDE_DIR LMDB_LIBRARY)