aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2023-05-25 01:24:39 +0100
committerJoão Valverde <j@v6e.pt>2023-05-26 00:18:59 +0100
commit8dc5d2d3486af6c00baa90704335769fe4a2e1c3 (patch)
tree1c3603cab0a86ff9366db9ee7c2fbdac827ad2ef /cmake/modules
parent16b99b0270909ca0a1a9da9be107c0686edbdf91 (diff)
Fedora: Fix cross-compilation with mingw-wpcap
Fix various issues preventing compilation with Fedora's MinGW WinPcap package.
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/FindPCAP.cmake12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmake/modules/FindPCAP.cmake b/cmake/modules/FindPCAP.cmake
index 0dec6edf8d..7e5f4fce1c 100644
--- a/cmake/modules/FindPCAP.cmake
+++ b/cmake/modules/FindPCAP.cmake
@@ -105,6 +105,8 @@ find_path(PCAP_INCLUDE_DIR
NAMES
pcap/pcap.h
pcap.h
+ PATH_SUFFIXES
+ wpcap
HINTS
${PC_PCAP_INCLUDE_DIRS}
${PCAP_CONFIG_INCLUDE_DIRS}
@@ -115,12 +117,13 @@ find_path(PCAP_INCLUDE_DIR
# capture\capture-wpcap.c. We don't want to link with pcap.lib since
# that would bring in the non-capturing (null) pcap.dll from the vcpkg
# library.
-if(WIN32)
+if(WIN32 AND NOT CMAKE_CROSSCOMPILING)
set(_pkg_required_vars PCAP_INCLUDE_DIR)
else()
find_library(PCAP_LIBRARY
NAMES
pcap
+ wpcap
HINTS
${PC_PCAP_LIBRARY_DIRS}
${PCAP_CONFIG_LIBRARY_DIRS}
@@ -185,7 +188,7 @@ if(PCAP_FOUND)
include(CheckSymbolExists)
- if(WIN32)
+ if(WIN32 AND NOT CMAKE_CROSSCOMPILING)
#
# Prepopulate some values. WinPcap 3.1 and later, and Npcap, have these
# in their SDK, and compilation checks on Windows can be slow. We check
@@ -238,7 +241,7 @@ if(PCAP_FOUND)
#
check_function_exists( "pcap_setsampling" HAVE_PCAP_SETSAMPLING )
endif( HAVE_PCAP_OPEN )
- endif(WIN32)
+ endif()
if( HAVE_PCAP_CREATE )
#
@@ -257,6 +260,9 @@ if(PCAP_FOUND)
set( HAVE_PCAP_REMOTE 1 )
endif()
+ check_symbol_exists(PCAP_ERROR_PROMISC_PERM_DENIED ${PCAP_INCLUDE_DIR}/pcap.h HAVE_PCAP_ERROR_PROMISC_PERM_DENIED)
+ check_symbol_exists(PCAP_WARNING_TSTAMP_TYPE_NOTSUP ${PCAP_INCLUDE_DIR}/pcap.h HAVE_PCAP_WARNING_TSTAMP_TYPE_NOTSUP)
+
cmake_pop_check_state()
endif()