2019-07-10 15:30:47 +00:00
|
|
|
# - Find pmem
|
|
|
|
#
|
2021-03-05 06:04:23 +00:00
|
|
|
# pmem_INCLUDE_DIRS - Where to find libpmem headers
|
|
|
|
# pmem_LIBRARIES - List of libraries when using libpmem.
|
2019-07-10 15:30:47 +00:00
|
|
|
# pmem_FOUND - True if pmem found.
|
|
|
|
|
2021-03-05 06:04:23 +00:00
|
|
|
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()
|
|
|
|
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()
|
2019-07-10 15:30:47 +00:00
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(pmem
|
2021-03-05 06:04:23 +00:00
|
|
|
DEFAULT_MSG pmem_INCLUDE_DIRS pmem_LIBRARIES)
|
2019-07-10 15:30:47 +00:00
|
|
|
|
|
|
|
mark_as_advanced(
|
2021-03-05 06:04:23 +00:00
|
|
|
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()
|
2019-07-10 15:30:47 +00:00
|
|
|
endif()
|