0003-FindPCAP.cmake-fix-static-build.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From 1ffe04d0f2ef3c7737f1f9667cfcdd6c4239bbbe Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Wed, 17 Apr 2019 23:58:55 +0200
  4. Subject: [PATCH] FindPCAP.cmake: fix static build
  5. When statically built, pcap can depends on other libraries such as
  6. -lnl-3. Add a call to pkg-config to find them and don't overwrite
  7. PCAP_LIBRARIES with PCAP_LIBRARY (use APPEND instead)
  8. Fixes:
  9. - http://autobuild.buildroot.org/results/277a24ad543a8f54cc8afde4f359f5d77b42eb7f
  10. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  11. [Upstream status: not sent yet (waiting feedback on first patch)]
  12. ---
  13. cmake/modules/FindPCAP.cmake | 7 ++++++-
  14. 1 file changed, 6 insertions(+), 1 deletion(-)
  15. diff --git a/cmake/modules/FindPCAP.cmake b/cmake/modules/FindPCAP.cmake
  16. index dfd80415f6..826ccfbdcc 100644
  17. --- a/cmake/modules/FindPCAP.cmake
  18. +++ b/cmake/modules/FindPCAP.cmake
  19. @@ -9,6 +9,11 @@
  20. include( FindWSWinLibs )
  21. FindWSWinLibs( "WpdPack" "PCAP_HINTS" )
  22. +if (NOT WIN32)
  23. + find_package(PkgConfig)
  24. + pkg_search_module( PCAP libpcap )
  25. +endif()
  26. +
  27. # The 64-bit wpcap.lib is under /x64
  28. set ( _PLATFORM_SUBDIR "" )
  29. if( WIN32 AND "${WIRESHARK_TARGET_PLATFORM}" STREQUAL "win64" )
  30. @@ -37,7 +42,7 @@ find_package_handle_standard_args( PCAP DEFAULT_MSG PCAP_LIBRARY PCAP_INCLUDE_DI
  31. if( PCAP_FOUND )
  32. set( PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR} )
  33. - set( PCAP_LIBRARIES ${PCAP_LIBRARY} )
  34. + list( APPEND PCAP_LIBRARIES ${PCAP_LIBRARY} )
  35. else()
  36. set( PCAP_INCLUDE_DIRS )
  37. set( PCAP_LIBRARIES )
  38. --
  39. 2.20.1