From 37a015a9eded393813b529ba6e5c06b3f3da2b9e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 3 Apr 2021 21:59:05 +0800 Subject: [PATCH] cmake: dedup components when finding pmem otherwise we always find libpmem twice if libpmem is explicitly specified when find_package() Signed-off-by: Kefu Chai --- cmake/modules/Findpmem.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/modules/Findpmem.cmake b/cmake/modules/Findpmem.cmake index def31cb1ff2..1f6e9eab0f5 100644 --- a/cmake/modules/Findpmem.cmake +++ b/cmake/modules/Findpmem.cmake @@ -6,7 +6,11 @@ find_package(PkgConfig QUIET REQUIRED) -foreach(component pmem ${pmem_FIND_COMPONENTS}) +# all pmem libraries depend on pmem, so always find it +set(pmem_FIND_COMPONENTS ${pmem_FIND_COMPONENTS} pmem) +list(REMOVE_DUPLICATES pmem_FIND_COMPONENTS) + +foreach(component ${pmem_FIND_COMPONENTS}) set(pmem_COMPONENTS pmem pmemobj) list(FIND pmem_COMPONENTS "${component}" found) if(found EQUAL -1)