summaryrefslogtreecommitdiffstats
path: root/cmake/modules
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2021-04-03 14:49:46 +0200
committerKefu Chai <kchai@redhat.com>2021-04-03 16:00:17 +0200
commitbf56cddce5b8319ccfe566d9698e2263afa131cf (patch)
tree7027deedd9c717a02f3a85be71faa86929d7ca04 /cmake/modules
parentMerge pull request #40564 from tchaikov/wip-crimson-internal_client_request-lite (diff)
downloadceph-bf56cddce5b8319ccfe566d9698e2263afa131cf.tar.xz
ceph-bf56cddce5b8319ccfe566d9698e2263afa131cf.zip
cmake: use .pc for hints for finding pmem libraries
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/Findpmem.cmake22
1 files changed, 18 insertions, 4 deletions
diff --git a/cmake/modules/Findpmem.cmake b/cmake/modules/Findpmem.cmake
index b30d9ae6bbb..603b3fbf60b 100644
--- a/cmake/modules/Findpmem.cmake
+++ b/cmake/modules/Findpmem.cmake
@@ -4,13 +4,27 @@
# pmem_LIBRARIES - List of libraries when using libpmem.
# pmem_FOUND - True if pmem found.
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PKG_pmem QUIET libpmem)
+ pkg_check_modules(PKG_pmemobj QUIET libpmemobj)
+endif()
+
foreach(component pmem ${pmem_FIND_COMPONENTS})
if(component STREQUAL pmem)
- find_path(pmem_${component}_INCLUDE_DIR libpmem.h)
- find_library(pmem_${component}_LIBRARY pmem)
+ find_path(pmem_${component}_INCLUDE_DIR
+ NAMES libpmem.h
+ HINTS ${PKG_pmem_INCLUDE_DIRS})
+ find_library(pmem_${component}_LIBRARY
+ NAMES pmem
+ HINTS ${PKG_pmem_LIBRARY_DIRS})
elseif(component STREQUAL pmemobj)
- find_path(pmem_${component}_INCLUDE_DIR libpmemobj.h)
- find_library(pmem_${component}_LIBRARY pmemobj)
+ find_path(pmem_${component}_INCLUDE_DIR
+ NAMES libpmemobj.h
+ HINTS ${PKG_pmemobj_INCLUDE_DIRS})
+ find_library(pmem_${component}_LIBRARY
+ NAMES pmemobj
+ HINTS ${PKG_pmemobj_LIBRARY_DIRS}))
else()
message(FATAL_ERROR "unknown libpmem component: ${component}")
endif()