blob: 9c8e21b918877ca88e39a6fbe208bf6754ea09e7 (
plain)
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
|
# - Find pmem
#
# pmem_INCLUDE_DIRS - Where to find libpmem headers
# pmem_LIBRARIES - List of libraries when using libpmem.
# pmem_FOUND - True if pmem found.
foreach(component pmem ${pmem_FIND_COMPONENTS})
if(component STREQUAL pmem)
find_path(pmem_${component}_INCLUDE_DIR libpmem.h)
find_library(pmem_${component}_LIBRARY pmem)
elseif(component STREQUAL pmemobj)
find_path(pmem_${component}_INCLUDE_DIR libpmemobj.h)
find_library(pmem_${component}_LIBRARY pmemobj)
else()
message(FATAL_ERROR "unknown libpmem component: ${component}")
endif()
pkg_check_modules(PKG_${component} QUIET "lib${component}")
if(NOT pmem_VERSION_STRING OR PKG_${component}_VERSION VERSION_LESS pmem_VERSION_STRING)
set(pmem_VERSION_STRING ${PKG_${component}_VERSION})
endif()
find_path(pmem_${component}_INCLUDE_DIR
NAMES lib${component}.h
HINTS ${PKG_${component}_INCLUDE_DIRS})
find_library(pmem_${component}_LIBRARY
NAMES ${component}
HINTS ${PKG_${component}_LIBRARY_DIRS})
mark_as_advanced(
pmem_${component}_INCLUDE_DIR
pmem_${component}_LIBRARY)
list(APPEND pmem_INCLUDE_DIRS "pmem_${component}_INCLUDE_DIR")
list(APPEND pmem_LIBRARIES "pmem_${component}_LIBRARY")
endforeach()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(pmem
DEFAULT_MSG pmem_INCLUDE_DIRS pmem_LIBRARIES)
mark_as_advanced(
pmem_INCLUDE_DIRS
pmem_LIBRARIES)
if(pmem_FOUND)
foreach(component pmem ${pmem_FIND_COMPONENTS})
if(NOT TARGET pmem::${component})
add_library(pmem::${component} UNKNOWN IMPORTED)
set_target_properties(pmem::${component} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${pmem_${component}_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${pmem_${component}_LIBRARY}")
# all pmem libraries calls into pmem::pmem
if(NOT component STREQUAL pmem)
set_target_properties(pmem::${component} PROPERTIES
INTERFACE_LINK_LIBRARIES pmem::pmem)
endif()
endif()
endforeach()
endif()
|