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()