summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2022-03-27 13:36:15 -0700
committerGuy Harris <gharris@sonic.net>2022-03-27 13:36:15 -0700
commit5a29e974b1fad6805b2d82b2d2e4b4693cfd3b15 (patch)
tree8c4b8ad7b04d8c3968eabf1e6ddee3b8a3c8d1fe /CMakeLists.txt
parentf2b82aea4d0bb73799028e3cb29fde25d756c4e3 (diff)
downloadlibpcap-5a29e974b1fad6805b2d82b2d2e4b4693cfd3b15.tar.gz
configure, CMake: use pkg-config first when checking for libibverbs.
That way, if it requires some extra flags or libraries, we find out about them. Clean up some comment typoes while we're at it.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 14 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b15d4a9..5d8fe5d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1713,17 +1713,27 @@ endif(NOT DISABLE_DBUS)
# Check for RDMA sniffing support
if(NOT DISABLE_RDMA)
- check_library_exists(ibverbs ibv_get_device_list "" LIBIBVERBS_HAS_IBV_GET_DEVICE_LIST)
- if(LIBIBVERBS_HAS_IBV_GET_DEVICE_LIST)
+ pkg_check_modules(LIBIBVERBS libibverbs)
+ if(NOT LIBIBVERBS_FOUND)
+ #
+ # pkg-config didn't find it; try to look for it ourselves
+ #
+ check_library_exists(ibverbs ibv_get_device_list "" LIBIBVERBS_HAS_IBV_GET_DEVICE_LIST)
+ if(LIBIBVERBS_HAS_IBV_GET_DEVICE_LIST)
+ set(LIBIBVERBS_FOUND TRUE)
+ set(LIBIBVERBS_LIBRARIES ibverbs)
+ endif()
+ endif()
+ if(LIBIBVERBS_FOUND)
check_include_file(infiniband/verbs.h HAVE_INFINIBAND_VERBS_H)
if(HAVE_INFINIBAND_VERBS_H)
check_symbol_exists(ibv_create_flow infiniband/verbs.h PCAP_SUPPORT_RDMASNIFF)
if(PCAP_SUPPORT_RDMASNIFF)
set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C} pcap-rdmasniff.c)
- set(PCAP_LINK_LIBRARIES ibverbs ${PCAP_LINK_LIBRARIES})
+ set(PCAP_LINK_LIBRARIES ${LIBIBVERBS_LIBRARIES} ${PCAP_LINK_LIBRARIES})
endif(PCAP_SUPPORT_RDMASNIFF)
endif(HAVE_INFINIBAND_VERBS_H)
- endif(LIBIBVERBS_HAS_IBV_GET_DEVICE_LIST)
+ endif(LIBIBVERBS_FOUND)
endif(NOT DISABLE_RDMA)
#