From 06ff8461c78292ff412fd90debbf1defc0524811 Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Mon, 25 Nov 2024 11:22:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91=E4=BE=9D=E8=B5=96=E5=BD=B1?= =?UTF-8?q?=E5=93=8D=E8=8C=83=E5=9B=B4=20(#4039)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See #4034 --- CMakeLists.txt | 9 --------- tests/CMakeLists.txt | 7 +++++++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d4f4f4b..b4d6cdd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -463,15 +463,6 @@ if(ENABLE_VIDEOSTACK) endif () endif () -if(NOT PCAP_FOUND AND ENABLE_TESTS) - find_package(PCAP QUIET) - if(PCAP_FOUND) - include_directories(SYSTEM ${PCAP_INCLUDE_DIRS}) - list(APPEND LINK_LIBRARIES ${PCAP_LIBRARIES}) - message(STATUS "found library: ${PCAP_LIBRARIES}") - endif() -endif() - # ---------------------------------------------------------------------------- # Solution folders: # ---------------------------------------------------------------------------- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index df016268..4820f777 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -23,6 +23,8 @@ aux_source_directory(. TEST_SRC_LIST) +find_package(PCAP QUIET) + foreach(TEST_SRC ${TEST_SRC_LIST}) get_filename_component(TEST_EXE_NAME ${TEST_SRC} NAME_WE) @@ -59,3 +61,8 @@ foreach(TEST_SRC ${TEST_SRC_LIST}) target_link_libraries(${TEST_EXE_NAME} ${MK_LINK_LIBRARIES}) endif() endforeach() + +if(TARGET test_rtp_pcap) + target_include_directories(test_rtp_pcap SYSTEM PRIVATE ${PCAP_INCLUDE_DIRS}) + target_link_libraries(test_rtp_pcap ${PCAP_LIBRARIES}) +endif()