File tree Expand file tree Collapse file tree 3 files changed +39
-5
lines changed
Expand file tree Collapse file tree 3 files changed +39
-5
lines changed Original file line number Diff line number Diff line change 77# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
88# The variable CVF_VERSION must be set before calling configure_file().
99
10- set (PACKAGE_VERSION "0.1 .0" )
10+ set (PACKAGE_VERSION "0.2 .0" )
1111
1212if (PACKAGE_FIND_VERSION_RANGE)
1313 # Package version must be in the requested version range
Original file line number Diff line number Diff line change @@ -49,7 +49,41 @@ endif()
4949
5050add_library (swiftnet STATIC ${SOURCE_FILES} )
5151target_compile_options (swiftnet PRIVATE -O0)
52- target_link_options (swiftnet PRIVATE -lpcap -O0)
52+ target_link_options (swiftnet PRIVATE -O0)
53+
54+ find_path (PCAP_INCLUDE_DIR
55+ NAMES pcap.h
56+ PATHS
57+ $ENV{VCPKG_ROOT} /installed
58+ /usr/include
59+ /usr/local/include
60+ /opt/homebrew/include
61+ /usr/include
62+ )
63+
64+ # Find libpcap library
65+ find_library (PCAP_LIBRARY
66+ NAMES pcap libpcap
67+ PATHS
68+ $ENV{VCPKG_ROOT} /installed
69+ /usr/lib
70+ /usr/local/lib
71+ /opt/homebrew/lib
72+ /usr/lib
73+ )
74+
75+ include (FindPackageHandleStandardArgs)
76+ find_package_handle_standard_args(Pcap DEFAULT_MSG PCAP_LIBRARY PCAP_INCLUDE_DIR)
77+
78+ if (PCAP_FOUND)
79+ message (STATUS "Found libpcap: ${PCAP_LIBRARY} (includes: ${PCAP_INCLUDE_DIR} )" )
80+ include_directories (${PCAP_INCLUDE_DIR} )
81+ else ()
82+ message (FATAL_ERROR "libpcap not found! Please install libpcap or set PCAP_INCLUDE_DIR/PCAP_LIBRARY" )
83+ endif ()
84+
85+ target_include_directories (swiftnet PUBLIC ${PCAP_INCLUDE_DIR} )
86+ target_link_libraries (swiftnet PUBLIC ${PCAP_LIBRARY} )
5387
5488set_target_properties (swiftnet PROPERTIES
5589 OUTPUT_NAME "swiftnet"
@@ -90,7 +124,7 @@ configure_package_config_file(
90124
91125write_basic_package_version_file(
92126 ${CMAKE_CURRENT_BINARY_DIR} /cmake/deadlightreal-swiftnetConfigVersion.cmake
93- VERSION 0.1 .0
127+ VERSION 0.2 .0
94128 COMPATIBILITY AnyNewerVersion
95129)
96130
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ file(GLOB SRC_FILES "${CMAKE_SOURCE_DIR}/src/*.c")
2727
2828add_executable (run_tests ${SRC_FILES} )
2929
30- target_link_libraries (run_tests swiftnet pcap )
31- target_link_options (run_tests PRIVATE -g -O0)
30+ target_link_libraries (run_tests PRIVATE swiftnet )
31+ target_link_options (run_tests PRIVATE -g -O0 -lpcap )
3232
3333set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} )
You can’t perform that action at this time.
0 commit comments