aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--cmake/modules/FindPCAP.cmake8
-rw-r--r--epan/CMakeLists.txt2
-rw-r--r--extcap/CMakeLists.txt2
-rw-r--r--ui/qt/CMakeLists.txt2
-rw-r--r--wsutil/CMakeLists.txt3
6 files changed, 13 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4e44f96849..4a51b61d1e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2433,7 +2433,6 @@ if(BUILD_randpkt)
wiretap
wsutil
${M_LIBRARIES}
- ${PCAP_LIBRARIES}
${CARES_LIBRARIES}
${ZLIB_LIBRARIES}
)
@@ -2580,7 +2579,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
wsutil
caputils
ui
- ${PCAP_LIBRARIES}
+ $<$<BOOL:${PCAP_FOUND}>:pcap::pcap>
${CAP_LIBRARIES}
${GLIB2_LIBRARIES}
${GTHREAD2_LIBRARIES}
diff --git a/cmake/modules/FindPCAP.cmake b/cmake/modules/FindPCAP.cmake
index 8bb9b524f7..eab41f185c 100644
--- a/cmake/modules/FindPCAP.cmake
+++ b/cmake/modules/FindPCAP.cmake
@@ -262,3 +262,11 @@ if(PCAP_FOUND)
cmake_pop_check_state()
endif()
+
+if(PCAP_FOUND AND NOT TARGET pcap::pcap)
+ add_library(pcap::pcap UNKNOWN IMPORTED)
+ set_target_properties(pcap::pcap PROPERTIES
+ IMPORTED_LOCATION "${PCAP_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PCAP_INCLUDE_DIRS}"
+ )
+endif()
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index 2cd73eaceb..3724e55e82 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -26,7 +26,6 @@ include_directories(
${LUA_INCLUDE_DIRS}
${LZ4_INCLUDE_DIRS}
${NGHTTP2_INCLUDE_DIRS}
- ${PCAP_INCLUDE_DIRS}
${SMI_INCLUDE_DIRS}
${SNAPPY_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
@@ -391,7 +390,6 @@ target_link_libraries(epan
${LZ4_LIBRARIES}
${M_LIBRARIES}
${NGHTTP2_LIBRARIES}
- ${PCAP_LIBRARIES}
${SMI_LIBRARIES}
${SNAPPY_LIBRARIES}
${WIN_PSAPI_LIBRARY}
diff --git a/extcap/CMakeLists.txt b/extcap/CMakeLists.txt
index 398d712efe..b07b58352c 100644
--- a/extcap/CMakeLists.txt
+++ b/extcap/CMakeLists.txt
@@ -91,8 +91,8 @@ if(BUILD_androiddump)
set(androiddump_LIBS
ui
${GLIB2_LIBRARIES}
- ${PCAP_LIBRARIES}
${WIN_WS2_32_LIBRARY}
+ $<$<BOOL:${PCAP_FOUND}>:pcap::pcap>
)
else()
message(FATAL_ERROR "You are trying to build androiddump with libpcap but do not have it")
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index 226e51f830..e31506cc4e 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -665,6 +665,8 @@ target_include_directories(qtui SYSTEM
${WINSPARKLE_INCLUDE_DIRS}
${SPEEXDSP_INCLUDE_DIRS}
PRIVATE
+ # Can't use imported target, linking object libraries for usage requirements
+ # requires CMake 3.12
${PCAP_INCLUDE_DIRS}
)
diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt
index f2a90a341f..17c6949133 100644
--- a/wsutil/CMakeLists.txt
+++ b/wsutil/CMakeLists.txt
@@ -267,10 +267,10 @@ target_link_libraries(wsutil
${APPLE_CORE_FOUNDATION_LIBRARY}
${GMODULE2_LIBRARIES}
${GLIB2_LIBRARIES}
- ${PCAP_LIBRARIES}
${GCRYPT_LIBRARIES}
${WIN_WS2_32_LIBRARY}
${GNUTLS_LIBRARIES}
+ $<$<BOOL:${PCAP_FOUND}>:pcap::pcap>
)
if(WIN32)
@@ -279,7 +279,6 @@ endif(WIN32)
target_include_directories(wsutil SYSTEM
PUBLIC
- ${PCAP_INCLUDE_DIRS}
${GCRYPT_INCLUDE_DIRS}
${GNUTLS_INCLUDE_DIRS}
)