11add_library (
22 Pcap++
3- src/DeviceUtils.cpp
3+ $<$< BOOL : ${PCAPPP_USE_PCAP} >: src /DeviceUtils .cpp >
44 $<$<BOOL :${PCAPPP_USE_DPDK} >:src /DpdkDevice .cpp >
55 $<$<BOOL :${PCAPPP_USE_DPDK} >:src /DpdkDeviceList .cpp >
66 $<$<BOOL :${PCAPPP_USE_DPDK_KNI} >:src /KniDevice .cpp >
77 $<$<BOOL :${PCAPPP_USE_DPDK_KNI} >:src /KniDeviceList .cpp >
88 $<$<BOOL :${LINUX} >:src /LinuxNicInformationSocket .cpp >
99 $<$<BOOL :${PCAPPP_USE_DPDK} >:src /MBufRawPacket .cpp >
10- src/PcapUtils.cpp
11- src/NetworkUtils.cpp
10+ $<$< BOOL : ${PCAPPP_USE_PCAP} >: src /PcapUtils .cpp >
11+ $<$< BOOL : ${PCAPPP_USE_PCAP} >: src /NetworkUtils .cpp >
1212 src/PcapFileDevice.cpp
13- src/PcapDevice.cpp
13+ $<$< BOOL : ${PCAPPP_USE_PCAP} >: src /PcapDevice .cpp >
1414 src/PcapFilter.cpp
15- src/PcapLiveDevice.cpp
16- src/PcapLiveDeviceList.cpp
17- $<$<BOOL :${WIN32} >:src /PcapRemoteDevice .cpp >
18- $<$<BOOL :${WIN32} >:src /PcapRemoteDeviceList .cpp >
15+ $<$< BOOL : ${PCAPPP_USE_PCAP} >: src /PcapLiveDevice .cpp >
16+ $<$< BOOL : ${PCAPPP_USE_PCAP} >: src /PcapLiveDeviceList .cpp >
17+ $<$<AND :$< BOOL :${WIN32} >,$< BOOL : ${PCAPPP_USE_PCAP} > >:src /PcapRemoteDevice .cpp >
18+ $<$<AND :$< BOOL :${WIN32} >,$< BOOL : ${PCAPPP_USE_PCAP} > >:src /PcapRemoteDeviceList .cpp >
1919 $<$<BOOL :${PCAPPP_USE_PF_RING} >:src /PfRingDevice .cpp >
2020 $<$<BOOL :${PCAPPP_USE_PF_RING} >:src /PfRingDeviceList .cpp >
2121 $<$<BOOL :${PCAPPP_USE_XDP} >:src /XdpDevice .cpp >
2222 src/RawSocketDevice.cpp
23- $<$<BOOL :${WIN32} >:src /WinPcapLiveDevice .cpp >
23+ $<$<AND :$< BOOL :${WIN32} >,$< BOOL : ${PCAPPP_USE_PCAP} > >:src /WinPcapLiveDevice .cpp >
2424 $<$<BOOL :${PCAPPP_USE_WINDIVERT} >:src /WinDivertDevice .cpp >
2525 # Force light pcapng to be link fully static
2626 $<TARGET_OBJECTS :light_pcapng >
@@ -63,7 +63,7 @@ if(LINUX)
6363 list (APPEND public_headers header/LinuxNicInformationSocket.h)
6464endif ()
6565
66- if (WIN32 )
66+ if (WIN32 AND PCAPPP_USE_PCAP )
6767 list (APPEND public_headers header/PcapRemoteDevice.h header/PcapRemoteDeviceList.h header/WinPcapLiveDevice.h)
6868endif ()
6969
@@ -76,10 +76,11 @@ target_compile_features(Pcap++ PUBLIC cxx_std_14)
7676if (APPLE )
7777 target_link_libraries (Pcap++ PRIVATE "-framework CoreFoundation" "-framework SystemConfiguration" )
7878elseif (WIN32 )
79- target_compile_definitions (Pcap++ PUBLIC -DHAVE_REMOTE )
80- target_compile_definitions (Pcap++ PUBLIC -DWPCAP )
8179 target_link_libraries (Pcap++ PRIVATE ws2_32 iphlpapi )
82- target_link_libraries (Pcap++ PUBLIC Packet::Packet )
80+ if (PCAPPP_USE_PCAP)
81+ target_compile_definitions (Pcap++ PUBLIC HAVE_REMOTE WPCAP )
82+ target_link_libraries (Pcap++ PUBLIC Packet::Packet )
83+ endif ()
8384endif ()
8485
8586target_include_directories (
@@ -103,7 +104,7 @@ target_link_libraries(
103104 $<$<BOOL :${PCAPPP_USE_DPDK} >:DPDK ::DPDK >
104105 $<$<BOOL :${PCAPPP_USE_XDP} >:BPF ::BPF >
105106 $<$<BOOL :${PCAPPP_USE_WINDIVERT} >:WinDivert ::WinDivert >
106- PCAP::PCAP
107+ $<$< BOOL : ${PCAPPP_USE_PCAP} >: PCAP ::PCAP >
107108 Threads::Threads
108109)
109110
0 commit comments