views:

19

answers:

1

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 files.

Has anyone managed to use winpcap with cmake?

A: 

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})
the_void