How do I tell cmake to do these two steps to use winpcap?
Quoted from here:
If your program uses Win32 specific functions of WinPcap, remember to include WPCAP among the preprocessor definitions.
If your program uses the remote capture capabilities of WinPcap, add HAVE_REMOTE among the preprocessor definitions. Do not include remote-ext.h directly in your source f开发者_StackOverflow中文版iles.
Has anyone managed to use winpcap with cmake?
Something like this should do it:
add_definitions(-DWPCAP -DHAVE_REMOTE)
find_path(WINPCAP_INCLUDE_DIR pcap.h
${WINPCAP_HINT_INCLUDE_DIR})
find_library(WINPCAP_LIBRARY NAMES "wpcap"
PATHS ${WINPCAP_HINT_LIB_DIR})
...
include_directories(${WINPCAP_INCLUDE_DIR})
target_link_library(my_lib ${WINPCAP_LIBRARY})
精彩评论