Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/topic/timw/vcpkg'
Browse files Browse the repository at this point in the history
* origin/topic/timw/vcpkg:
  Use pcap_static as the library name on Windows
  Remove unused conan.cmake
  Make test for pcap_code look for a symbol instead of the header
  • Loading branch information
timwoj committed Feb 21, 2024
2 parents 01fcb68 + bec5aec commit dfa2657
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1,028 deletions.
6 changes: 5 additions & 1 deletion FindPCAP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ else ()
set(_pcap_lib_hint_path ${PCAP_ROOT_DIR}/lib)
endif ()

find_library(PCAP_LIBRARY NAMES pcap wpcap HINTS ${_pcap_lib_hint_path})
if (MSVC)
find_library(PCAP_LIBRARY NAMES pcap_static wpcap HINTS ${_pcap_lib_hint_path})
else ()
find_library(PCAP_LIBRARY NAMES pcap wpcap HINTS ${_pcap_lib_hint_path})
endif ()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PCAP DEFAULT_MSG PCAP_LIBRARY PCAP_INCLUDE_DIR)
Expand Down
6 changes: 5 additions & 1 deletion PCAPTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ check_include_files(pcap-int.h HAVE_PCAP_INT_H)

cmake_policy(POP)

check_function_exists(pcap_freecode HAVE_LIBPCAP_PCAP_FREECODE)
check_symbol_exists(pcap_freecode pcap.h HAVE_LIBPCAP_PCAP_FREECODE)
if (NOT HAVE_LIBPCAP_PCAP_FREECODE)
set(DONT_HAVE_LIBPCAP_PCAP_FREECODE true)
message(STATUS "No implementation for pcap_freecode()")
endif ()

if (DONT_HAVE_LIBPCAP_PCAP_FREECODE AND NOT HAVE_PCAP_INT_H)
message(FATAL_ERROR "pcap-int.h required to implement pcap_freecode() internally")
endif()

check_symbol_exists(DLT_PPP_SERIAL pcap.h HAVE_DLT_PPP_SERIAL)
if (NOT HAVE_DLT_PPP_SERIAL)
set(DLT_PPP_SERIAL 50)
Expand Down
Loading

0 comments on commit dfa2657

Please sign in to comment.