From 27d33352b28654605b1894e651eb43ef4610e850 Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Thu, 17 Aug 2023 02:06:40 +0530 Subject: [PATCH] Add separate option to enable Examples installing --- CMakeLists.txt | 1 + Examples/ArpSpoofing/CMakeLists.txt | 2 +- Examples/Arping/CMakeLists.txt | 2 +- Examples/DNSResolver/CMakeLists.txt | 2 +- Examples/DnsSpoofing/CMakeLists.txt | 2 +- Examples/DpdkBridge/CMakeLists.txt | 2 +- Examples/DpdkExample-FilterTraffic/CMakeLists.txt | 2 +- Examples/HttpAnalyzer/CMakeLists.txt | 2 +- Examples/IPDefragUtil/CMakeLists.txt | 2 +- Examples/IPFragUtil/CMakeLists.txt | 2 +- Examples/IcmpFileTransfer/CMakeLists.txt | 4 ++-- Examples/KniPong/CMakeLists.txt | 2 +- Examples/PcapPlusPlus-benchmark/CMakeLists.txt | 2 +- Examples/PcapPrinter/CMakeLists.txt | 2 +- Examples/PcapSearch/CMakeLists.txt | 2 +- Examples/PcapSplitter/CMakeLists.txt | 2 +- Examples/PfRingExample-FilterTraffic/CMakeLists.txt | 2 +- Examples/SSLAnalyzer/CMakeLists.txt | 2 +- Examples/TLSFingerprinting/CMakeLists.txt | 2 +- Examples/TcpReassembly/CMakeLists.txt | 2 +- 20 files changed, 21 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72c43dd711..eff88ce89b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,7 @@ option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) option(PCAPPP_USE_DPDK "Setup PcapPlusPlus with DPDK. In this case you must also set DPDK_ROOT") option(PCAPPP_USE_PF_RING "Setup PcapPlusPlus with PF_RING. In this case you must also set PF_RING_ROOT") option(PCAPPP_INSTALL "Install Pcap++" ${PCAPPP_MAIN_PROJECT}) +option(PCAPPP_INSTALL_EXAMPLES "Install Pcap++ examples" OFF) # Set C++11 set(CMAKE_CXX_STANDARD 11) diff --git a/Examples/ArpSpoofing/CMakeLists.txt b/Examples/ArpSpoofing/CMakeLists.txt index 81aeb2443d..4b870bf32c 100644 --- a/Examples/ArpSpoofing/CMakeLists.txt +++ b/Examples/ArpSpoofing/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(ArpSpoofing PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS ArpSpoofing EXPORT PcapPlusPlusTargets diff --git a/Examples/Arping/CMakeLists.txt b/Examples/Arping/CMakeLists.txt index 78e174f5c2..297c5e40e3 100644 --- a/Examples/Arping/CMakeLists.txt +++ b/Examples/Arping/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(Arping PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS Arping EXPORT PcapPlusPlusTargets diff --git a/Examples/DNSResolver/CMakeLists.txt b/Examples/DNSResolver/CMakeLists.txt index a66fe4722a..aef7e663ab 100644 --- a/Examples/DNSResolver/CMakeLists.txt +++ b/Examples/DNSResolver/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(DNSResolver PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS DNSResolver EXPORT PcapPlusPlusTargets diff --git a/Examples/DnsSpoofing/CMakeLists.txt b/Examples/DnsSpoofing/CMakeLists.txt index a883c9d2c8..197e98001a 100644 --- a/Examples/DnsSpoofing/CMakeLists.txt +++ b/Examples/DnsSpoofing/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(DnsSpoofing PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS DnsSpoofing EXPORT PcapPlusPlusTargets diff --git a/Examples/DpdkBridge/CMakeLists.txt b/Examples/DpdkBridge/CMakeLists.txt index f460c1c6c7..19291519d2 100644 --- a/Examples/DpdkBridge/CMakeLists.txt +++ b/Examples/DpdkBridge/CMakeLists.txt @@ -4,7 +4,7 @@ target_link_libraries(DpdkBridge PUBLIC PcapPlusPlus::Pcap++) set_target_properties(DpdkBridge PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS DpdkBridge EXPORT PcapPlusPlusTargets diff --git a/Examples/DpdkExample-FilterTraffic/CMakeLists.txt b/Examples/DpdkExample-FilterTraffic/CMakeLists.txt index 2c25d8d50f..ceccf7f76c 100644 --- a/Examples/DpdkExample-FilterTraffic/CMakeLists.txt +++ b/Examples/DpdkExample-FilterTraffic/CMakeLists.txt @@ -4,7 +4,7 @@ target_link_libraries(DpdkTrafficFilter PUBLIC PcapPlusPlus::Pcap++) set_target_properties(DpdkTrafficFilter PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS DpdkTrafficFilter EXPORT PcapPlusPlusTargets diff --git a/Examples/HttpAnalyzer/CMakeLists.txt b/Examples/HttpAnalyzer/CMakeLists.txt index 34e221a087..e1ed8869e8 100644 --- a/Examples/HttpAnalyzer/CMakeLists.txt +++ b/Examples/HttpAnalyzer/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(HttpAnalyzer PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS HttpAnalyzer EXPORT PcapPlusPlusTargets diff --git a/Examples/IPDefragUtil/CMakeLists.txt b/Examples/IPDefragUtil/CMakeLists.txt index 42335419d3..66fba3f278 100644 --- a/Examples/IPDefragUtil/CMakeLists.txt +++ b/Examples/IPDefragUtil/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(IPDefragUtil PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS IPDefragUtil EXPORT PcapPlusPlusTargets diff --git a/Examples/IPFragUtil/CMakeLists.txt b/Examples/IPFragUtil/CMakeLists.txt index bbe1dee206..f94d8b8d52 100644 --- a/Examples/IPFragUtil/CMakeLists.txt +++ b/Examples/IPFragUtil/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(IPFragUtil PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS IPFragUtil EXPORT PcapPlusPlusTargets diff --git a/Examples/IcmpFileTransfer/CMakeLists.txt b/Examples/IcmpFileTransfer/CMakeLists.txt index d6a84fcc6e..8862af6b32 100644 --- a/Examples/IcmpFileTransfer/CMakeLists.txt +++ b/Examples/IcmpFileTransfer/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(IcmpFileTransfer-catcher PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS IcmpFileTransfer-catcher EXPORT PcapPlusPlusTargets @@ -27,7 +27,7 @@ endif() set_target_properties(IcmpFileTransfer-pitcher PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS IcmpFileTransfer-pitcher EXPORT PcapPlusPlusTargets diff --git a/Examples/KniPong/CMakeLists.txt b/Examples/KniPong/CMakeLists.txt index 058486bb8c..f76d01f615 100644 --- a/Examples/KniPong/CMakeLists.txt +++ b/Examples/KniPong/CMakeLists.txt @@ -4,7 +4,7 @@ target_link_libraries(KniPong PUBLIC PcapPlusPlus::Pcap++) set_target_properties(KniPong PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS KniPong EXPORT PcapPlusPlusTargets diff --git a/Examples/PcapPlusPlus-benchmark/CMakeLists.txt b/Examples/PcapPlusPlus-benchmark/CMakeLists.txt index 584d6353dd..d6b31c9686 100644 --- a/Examples/PcapPlusPlus-benchmark/CMakeLists.txt +++ b/Examples/PcapPlusPlus-benchmark/CMakeLists.txt @@ -4,7 +4,7 @@ target_link_libraries(benchmark PUBLIC PcapPlusPlus::Pcap++) set_target_properties(benchmark PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS benchmark EXPORT PcapPlusPlusTargets diff --git a/Examples/PcapPrinter/CMakeLists.txt b/Examples/PcapPrinter/CMakeLists.txt index 67a15c40ee..0d47aa2615 100644 --- a/Examples/PcapPrinter/CMakeLists.txt +++ b/Examples/PcapPrinter/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(PcapPrinter PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS PcapPrinter EXPORT PcapPlusPlusTargets diff --git a/Examples/PcapSearch/CMakeLists.txt b/Examples/PcapSearch/CMakeLists.txt index ecfb9e992e..5b215afbd7 100644 --- a/Examples/PcapSearch/CMakeLists.txt +++ b/Examples/PcapSearch/CMakeLists.txt @@ -10,7 +10,7 @@ endif() set_target_properties(PcapSearch PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS PcapSearch EXPORT PcapPlusPlusTargets diff --git a/Examples/PcapSplitter/CMakeLists.txt b/Examples/PcapSplitter/CMakeLists.txt index 4f65d07ea3..778d6d8eab 100644 --- a/Examples/PcapSplitter/CMakeLists.txt +++ b/Examples/PcapSplitter/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(PcapSplitter PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS PcapSplitter EXPORT PcapPlusPlusTargets diff --git a/Examples/PfRingExample-FilterTraffic/CMakeLists.txt b/Examples/PfRingExample-FilterTraffic/CMakeLists.txt index 0c8a1b37f5..477692764e 100644 --- a/Examples/PfRingExample-FilterTraffic/CMakeLists.txt +++ b/Examples/PfRingExample-FilterTraffic/CMakeLists.txt @@ -4,7 +4,7 @@ target_link_libraries(PfRingTrafficFilter PUBLIC PcapPlusPlus::Pcap++) set_target_properties(PfRingTrafficFilter PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS PfRingTrafficFilter EXPORT PcapPlusPlusTargets diff --git a/Examples/SSLAnalyzer/CMakeLists.txt b/Examples/SSLAnalyzer/CMakeLists.txt index 3bc682939f..f784f612c5 100644 --- a/Examples/SSLAnalyzer/CMakeLists.txt +++ b/Examples/SSLAnalyzer/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(SSLAnalyzer PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS SSLAnalyzer EXPORT PcapPlusPlusTargets diff --git a/Examples/TLSFingerprinting/CMakeLists.txt b/Examples/TLSFingerprinting/CMakeLists.txt index f47aacdc8f..a8701c4627 100644 --- a/Examples/TLSFingerprinting/CMakeLists.txt +++ b/Examples/TLSFingerprinting/CMakeLists.txt @@ -10,7 +10,7 @@ endif() set_target_properties(TLSFingerprinting PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}" RUNTIME_OUTPUT_NAME "TLSFingerprinting") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS TLSFingerprinting EXPORT PcapPlusPlusTargets diff --git a/Examples/TcpReassembly/CMakeLists.txt b/Examples/TcpReassembly/CMakeLists.txt index d2cbf5f2fc..54c71eec20 100644 --- a/Examples/TcpReassembly/CMakeLists.txt +++ b/Examples/TcpReassembly/CMakeLists.txt @@ -9,7 +9,7 @@ endif() set_target_properties(TcpReassembly PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PCAPPP_BINARY_EXAMPLES_DIR}") -if(PCAPPP_INSTALL) +if(PCAPPP_INSTALL_EXAMPLES) install( TARGETS TcpReassembly EXPORT PcapPlusPlusTargets