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 <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2021-04-03 21:59:05 +08:00
parent 6978584e99
commit 37a015a9ed

View File

@ -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)