add_library( Pcap++ $<$:src/DeviceUtils.cpp> $<$:src/DpdkDevice.cpp> $<$:src/DpdkDeviceList.cpp> $<$:src/KniDevice.cpp> $<$:src/KniDeviceList.cpp> $<$:src/LinuxNicInformationSocket.cpp> $<$:src/MBufRawPacket.cpp> $<$:src/PcapUtils.cpp> $<$:src/NetworkUtils.cpp> src/PcapFileDevice.cpp $<$:src/PcapDevice.cpp> src/PcapFilter.cpp $<$:src/PcapLiveDevice.cpp> $<$:src/PcapLiveDeviceList.cpp> $<$,$>:src/PcapRemoteDevice.cpp> $<$,$>:src/PcapRemoteDeviceList.cpp> $<$:src/PfRingDevice.cpp> $<$:src/PfRingDeviceList.cpp> $<$:src/XdpDevice.cpp> src/RawSocketDevice.cpp $<$,$>:src/WinPcapLiveDevice.cpp> $<$:src/WinDivertDevice.cpp> # Force light pcapng to be link fully static $ ) set( public_headers header/Device.h header/DeviceListBase.h header/NetworkUtils.h header/PcapDevice.h header/PcapFileDevice.h header/PcapFilter.h header/PcapLiveDevice.h header/PcapLiveDeviceList.h header/RawSocketDevice.h ) if(PCAPPP_USE_DPDK) list(APPEND public_headers header/DpdkDevice.h header/DpdkDeviceList.h header/MBufRawPacket.h) endif() if(PCAPPP_USE_DPDK_KNI) list(APPEND public_headers header/KniDevice.h header/KniDeviceList.h) endif() if(PCAPPP_USE_PF_RING) list(APPEND public_headers header/PfRingDevice.h header/PfRingDeviceList.h) endif() if(PCAPPP_USE_XDP) list(APPEND public_headers header/XdpDevice.h) endif() if(PCAPPP_USE_WINDIVERT) list(APPEND public_headers header/WinDivertDevice.h) endif() if(LINUX) list(APPEND public_headers header/LinuxNicInformationSocket.h) endif() if(WIN32 AND PCAPPP_USE_PCAP) list(APPEND public_headers header/PcapRemoteDevice.h header/PcapRemoteDeviceList.h header/WinPcapLiveDevice.h) endif() set_property(TARGET Pcap++ PROPERTY PUBLIC_HEADER ${public_headers}) target_sources(Pcap++ PRIVATE ${public_headers}) target_compile_features(Pcap++ PUBLIC cxx_std_14) if(APPLE) target_link_libraries(Pcap++ PRIVATE "-framework CoreFoundation" "-framework SystemConfiguration") elseif(WIN32) target_link_libraries(Pcap++ PRIVATE ws2_32 iphlpapi) if(PCAPPP_USE_PCAP) target_compile_definitions(Pcap++ PUBLIC HAVE_REMOTE WPCAP) target_link_libraries(Pcap++ PUBLIC Packet::Packet) endif() endif() target_include_directories( Pcap++ PUBLIC $ $ $ # Don't link with EndianPortable nor Light_PcapNG as they won't be exported PRIVATE $ $ ) target_link_libraries( Pcap++ PUBLIC Common++ Packet++ $<$:PF_RING::PF_RING> $<$:DPDK::DPDK> $<$:BPF::BPF> $<$:WinDivert::WinDivert> $<$:PCAP::PCAP> Threads::Threads ) if(LIGHT_PCAPNG_ZSTD) target_link_libraries(Pcap++ PRIVATE light_pcapng) endif() if(PCAPPP_INSTALL) install( TARGETS Pcap++ EXPORT PcapPlusPlusTargets ARCHIVE DESTINATION ${PCAPPP_INSTALL_LIBDIR} LIBRARY DESTINATION ${PCAPPP_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${PCAPPP_INSTALL_INCLUDEDIR} RUNTIME DESTINATION ${PCAPPP_INSTALL_BINDIR} ) endif() set_property(TARGET Pcap++ PROPERTY OUTPUT_NAME "Pcap++") set_property(TARGET Pcap++ PROPERTY VERSION ${PCAPPP_VERSION}) set_property(TARGET Pcap++ PROPERTY COMPILE_WARNING_AS_ERROR ON)