Skip to content

Commit

Permalink
Avoid compiling same files twice
Browse files Browse the repository at this point in the history
  • Loading branch information
huitema committed Mar 1, 2024
1 parent fd62b2d commit 5ed699d
Showing 1 changed file with 76 additions and 66 deletions.
142 changes: 76 additions & 66 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,36 @@ SET(CMAKE_CXX_FLAGS "-Wall -O2 -g ${CMAKE_CXX_FLAGS}")

INCLUDE_DIRECTORIES(src lib test include cdns/lib)

SET(ITHITOOLS_LIBRARY_HEADERS
lib/AddressFilter.h
lib/CaptureSummary.h
lib/ComputeM34.h
lib/ComputeM6.h
lib/ComputeMetric.h
lib/config.h
lib/CsvHelper.h
lib/dnscap_common.h
lib/DnsStats.h
lib/DnsTypes.h
lib/HashBinGeneric.h
lib/ipstats.h
lib/ithimetrics.h
lib/ithipublisher.h
lib/ithiutil.h
lib/ithi_getopt.h
lib/linktype.h
lib/M1Data.h
lib/M2Data.h
lib/M7Getter.h
lib/NamePattern.h
lib/OdiPublisher.h
lib/pcap_reader.h
lib/QNameMinimization.h
lib/TldAsKey.h
lib/UsefulTransaction.h
lib/Version.h
)

SET(ITHITOOLS_LIBRARY_FILES
lib/AddressFilter.cpp
lib/CaptureSummary.cpp
Expand All @@ -40,6 +70,38 @@ SET(ITHITOOLS_LIBRARY_FILES
lib/OdiPublisher.cpp
)

add_library(ithitools-core ${ITHITOOLS_LIBRARY_HEADERS} ${ITHITOOLS_LIBRARY_FILES})
target_include_directories(ithitools-core
PUBLIC
lib)

SET(ITHITOOLS_TEST_LIBRARY_HEADERS
test/CaptureTest.h
test/capture_fuzz.h
test/CdnsCaptureTest.h
test/CsvTest.h
test/DnsPrefixTest.h
test/GetNameTest.h
test/hashtest.h
test/HyperLogLogTest.h
test/IPStatsTest.h
test/ithi_test_class.h
test/LoadTest.h
test/M1DataTest.h
test/M2DataTest.h
test/MergeTest.h
test/MetricTest.h
test/OdiPublishTest.h
test/PatternTest.h
test/PluginTest.h
test/PublishTest.h
test/QNameTest.h
test/SaveTest.h
test/StatsByIpTest.h
test/testRfc6761.h
test/TldCountTest.h
)

SET(ITHITOOLS_TEST_LIBRARY_FILES
test/CaptureTest.cpp
test/CborTest.cpp
Expand All @@ -48,6 +110,7 @@ SET(ITHITOOLS_TEST_LIBRARY_FILES
test/hashtest.cpp
test/GetNameTest.cpp
test/HyperLogLogTest.cpp
test/IPStatsTest.cpp
test/LoadTest.cpp
test/MergeTest.cpp
test/MetricTest.cpp
Expand All @@ -67,77 +130,24 @@ SET(ITHITOOLS_TEST_LIBRARY_FILES
test/capture_fuzz.cpp
)

add_library(ithitools-test ${ITHITOOLS_LIBRARY_HEADERS}
${ITHITOOLS_TEST_LIBRARY_HEADERS}
${ITHITOOLS_TEST_LIBRARY_FILES})
target_include_directories(ithitools-test
PUBLIC
lib
test
)

ADD_EXECUTABLE(ithitools
src/ithitools.cpp
lib/AddressFilter.cpp
lib/CaptureSummary.cpp
cdns/lib/cbor.cpp
cdns/lib/cdns.cpp
lib/ComputeMetric.cpp
lib/ComputeM34.cpp
lib/ComputeM6.cpp
lib/CsvHelper.cpp
lib/DnsStats.cpp
lib/getopt.c
lib/ipstats.cpp
lib/ithimetrics.cpp
lib/ithipublisher.cpp
lib/ithiutil.cpp
lib/M1Data.cpp
lib/M2Data.cpp
lib/M7Getter.cpp
lib/NamePattern.cpp
lib/OdiPublisher.cpp
lib/pcap_reader.cpp
ithitools-core
)

ADD_EXECUTABLE(ithitest
src/ithitest.cpp
lib/AddressFilter.cpp
lib/CaptureSummary.cpp
cdns/lib/cbor.cpp
cdns/lib/cdns.cpp
lib/ComputeMetric.cpp
lib/ComputeM34.cpp
lib/ComputeM6.cpp
lib/DnsStats.cpp
lib/ipstats.cpp
lib/ithimetrics.cpp
lib/ithipublisher.cpp
lib/ithiutil.cpp
lib/NamePattern.cpp
lib/DnscapPlugIn.cpp
lib/M7Getter.cpp
lib/CsvHelper.cpp
lib/M1Data.cpp
lib/M2Data.cpp
lib/OdiPublisher.cpp
lib/pcap_reader.cpp
lib/getopt.c
test/CaptureTest.cpp
test/CdnsCaptureTest.cpp
test/DnsPrefixTest.cpp
test/hashtest.cpp
test/HyperLogLogTest.cpp
test/GetNameTest.cpp
test/LoadTest.cpp
test/MergeTest.cpp
test/MetricTest.cpp
test/M1DataTest.cpp
test/M2DataTest.cpp
test/SaveTest.cpp
test/testRfc6761.cpp
test/PatternTest.cpp
test/PluginTest.cpp
test/PublishTest.cpp
test/CsvTest.cpp
test/TldCountTest.cpp
test/ithi_test_class.cpp
test/HyperLogLogTest.cpp
test/OdiPublishTest.cpp
test/QNameTest.cpp
test/StatsByIpTest.cpp
test/capture_fuzz.cpp
ithitools-core
ithitools-test
)

ADD_LIBRARY(ithicap SHARED
Expand All @@ -160,7 +170,7 @@ SET_TARGET_PROPERTIES(ithicap PROPERTIES
VERSION 2.03
PUBLIC_HEADER include/ithicap.h)

SET_TARGET_PROPERTIES(ithitools PROPERTIES VERSION 2.03)
SET_TARGET_PROPERTIES(ithitools PROPERTIES VERSION 2.10)

SET(TEST_EXES ithitest)

Expand Down

0 comments on commit 5ed699d

Please sign in to comment.