Skip to content

Commit 1b1f616

Browse files
committed
cleanup find_threads and find_pcap issues
Signed-off-by: Stephen L Arnold <sarnold@vctlabs.com>
1 parent 2384d39 commit 1b1f616

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ project(
2424
LANGUAGES CXX
2525
)
2626

27+
# Check the thread library info early as setting compiler flags seems to
28+
# interfere with the detection and causes CMAKE_THREAD_LIBS_INIT to not
29+
# include -lpthread when it should.
30+
if(LIBTINS_BUILD_TESTS)
31+
if (NOT TARGET Threads::Threads)
32+
find_package(Threads REQUIRED)
33+
endif ()
34+
set(LINK_LIBS ${LINK_LIBS} Threads::Threads)
35+
endif()
36+
2737
# Compilation flags.
2838
IF(MSVC)
2939
# Don't always use Wall, since VC's /Wall is ridiculously verbose.

cmake/Modules/FindPCAP.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ endif (NOT PCAP_LINKS_SOLO)
7373

7474
include(CheckFunctionExists)
7575
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY})
76-
check_function_exists(pcap_get_pfring_id HAVE_PF_RING)
76+
# this is not actually used, is not part of normal libpcap, and
77+
# causes breakage in some build environments, eg, bookworm docker image
78+
#check_function_exists(pcap_get_pfring_id HAVE_PF_RING)
7779
check_function_exists(pcap_set_immediate_mode HAVE_PCAP_IMMEDIATE_MODE)
7880
check_function_exists(pcap_set_tstamp_precision HAVE_PCAP_TIMESTAMP_PRECISION)
7981
set(CMAKE_REQUIRED_LIBRARIES)

tests/src/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ INCLUDE_DIRECTORIES(
66
${PCAP_INCLUDE_DIR}
77
)
88

9-
# Find pthread library
10-
FIND_PACKAGE(Threads REQUIRED)
11-
129
LINK_DIRECTORIES(
1310
${GOOGLETEST_LIBRARY}
1411
)
@@ -104,4 +101,3 @@ IF(LIBTINS_ENABLE_DOT11)
104101
CREATE_TEST(wpa2_decrypt)
105102
ENDIF()
106103
ENDIF()
107-

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ deps =
4242
ninja
4343

4444
commands =
45-
cmake -G {posargs:"Unix Makefiles"} -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX={env:PREFIX} -DLIBTINS_ENABLE_CXX11=ON -DLIBTINS_ENABLE_ACK_TRACKER=OFF -DLIBTINS_ENABLE_WPA2=OFF -DLIBTINS_ENABLE_DOT11=OFF
45+
cmake -G {posargs:"Unix Makefiles"} -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX={env:PREFIX} -DLIBTINS_ENABLE_CXX11=ON -DLIBTINS_ENABLE_ACK_TRACKER=OFF -DLIBTINS_ENABLE_WPA2=OFF -DLIBTINS_ENABLE_DOT11=OFF -DLIBTINS_BUILD_TESTS=OFF
4646
cmake --build build -j 4 --target install
4747
bash -c 'ls -lh $PREFIX/*'
4848

0 commit comments

Comments
 (0)