Skip to content

Commit 3e1745d

Browse files
authored
chore: use cmake style for package includes in src folder (#723)
1 parent 70d89ed commit 3e1745d

13 files changed

Lines changed: 57 additions & 39 deletions

File tree

src/CMakeLists.txt

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@ message(STATUS "visor-core")
33

44
set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)
55

6-
#generate cpp code from opentelemetry-proto
76
find_package(Protobuf REQUIRED)
7+
find_package(fmt REQUIRED)
8+
find_package(httplib REQUIRED)
9+
find_package(maxminddb REQUIRED)
10+
find_package(fast-cpp-csv-parser REQUIRED)
11+
find_package(OpenSSL REQUIRED)
12+
find_package(spdlog REQUIRED)
13+
find_package(yaml-cpp REQUIRED)
14+
find_package(Catch2 REQUIRED)
15+
16+
#generate cpp code from opentelemetry-proto
817
find_program(PROTOBUF_PROTOC_EXECUTABLE NAMES protoc PATHS ${CONAN_BIN_DIRS_PROTOBUF})
918
set(OTELCPP_PROTO_PATH ${CONAN_OPENTELEMETRY-PROTO_ROOT}/res)
1019
set(BUILD_SHARED_LIBS FALSE)
@@ -40,16 +49,14 @@ target_link_libraries(visor-core
4049
rng
4150
timer
4251
opentelemetry_proto
43-
${CONAN_LIBS_PROTOBUF}
44-
${CONAN_LIBS_ABSEIL}
45-
${CONAN_LIBS_LIBMAXMINDDB}
46-
${CONAN_LIBS_CORRADE}
47-
${CONAN_LIBS_SPDLOG}
48-
${CONAN_LIBS_FMT}
49-
${CONAN_LIBS_FAST-CPP-CSV-PARSER}
50-
${CONAN_LIBS_YAML-CPP}
51-
${CONAN_LIBS_OPENSSL}
52-
${CONAN_LIBS_ZLIB}
52+
protobuf::libprotobuf
53+
maxminddb::maxminddb
54+
Corrade::Corrade
55+
spdlog::spdlog
56+
fmt::fmt
57+
fast-cpp-csv-parser::fast-cpp-csv-parser
58+
yaml-cpp::yaml-cpp
59+
OpenSSL::SSL
5360
${VISOR_STATIC_PLUGINS}
5461
)
5562

@@ -77,7 +84,7 @@ target_link_libraries(unit-tests-visor-core
7784
PRIVATE
7885
Visor::Core
7986
${VISOR_STATIC_PLUGINS}
80-
${CONAN_LIBS_CATCH2})
87+
catch2::catch2_with_main)
8188

8289
add_test(NAME unit-tests-visor-core
8390
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src

src/handlers/bgp/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ add_executable(unit-tests-handler-bgp
2424
tests/test_bgp_layer.cpp
2525
tests/test_json_schema.cpp)
2626

27+
find_package(nlohmann_json_schema_validator REQUIRED)
28+
2729
target_link_libraries(unit-tests-handler-bgp
2830
PRIVATE
29-
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
31+
nlohmann_json_schema_validator
3032
Visor::Handler::Bgp
3133
Visor::Lib::Test)
3234

src/handlers/dhcp/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ add_executable(unit-tests-handler-dhcp
2626
tests/test_dhcp_layer.cpp
2727
tests/test_json_schema.cpp)
2828

29+
find_package(nlohmann_json_schema_validator REQUIRED)
30+
2931
target_link_libraries(unit-tests-handler-dhcp
3032
PRIVATE
31-
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
33+
nlohmann_json_schema_validator
3234
Visor::Handler::Dhcp
3335
Visor::Lib::Test)
3436

src/handlers/dns/v1/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ add_executable(unit-tests-handler-dns
3232
tests/test_dnstap.cpp
3333
tests/test_json_schema.cpp)
3434

35+
find_package(nlohmann_json_schema_validator REQUIRED)
36+
3537
target_link_libraries(unit-tests-handler-dns
3638
PRIVATE
37-
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
39+
nlohmann_json_schema_validator
3840
Visor::Handler::Dns
3941
Visor::Lib::Test)
4042

src/handlers/dns/v2/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ add_executable(unit-tests-handler-dns-v2
3131
tests/test_dns_layer.cpp
3232
tests/test_dnstap.cpp)
3333

34+
find_package(nlohmann_json_schema_validator REQUIRED)
35+
3436
target_link_libraries(unit-tests-handler-dns-v2
3537
PRIVATE
36-
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
38+
nlohmann_json_schema_validator
3739
Visor::Handler::Dns::V2
3840
Visor::Lib::Test)
3941

src/handlers/net/v1/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ else()
3535
tests/test_json_schema.cpp)
3636
endif()
3737

38+
find_package(nlohmann_json_schema_validator REQUIRED)
39+
3840
target_link_libraries(unit-tests-handler-net
3941
PRIVATE
40-
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
42+
nlohmann_json_schema_validator
4143
Visor::Handler::Net
4244
Visor::Handler::Dns
4345
Visor::Lib::Test)

src/handlers/net/v2/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ set(VISOR_STATIC_PLUGINS ${VISOR_STATIC_PLUGINS} Visor::Handler::Net::V2 PARENT_
2929
if (NOT WIN32)
3030
add_executable(unit-tests-handler-net-v2 tests/test_net_layer.cpp)
3131

32+
find_package(nlohmann_json_schema_validator REQUIRED)
33+
3234
target_link_libraries(unit-tests-handler-net-v2
3335
PRIVATE
34-
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
36+
nlohmann_json_schema_validator
3537
Visor::Handler::Net::V2
3638
Visor::Handler::Dns::V2
3739
Visor::Lib::Test)

src/handlers/pcap/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ add_executable(unit-tests-handler-pcap
2727
tests/test_pcap_layer.cpp
2828
tests/test_json_schema.cpp)
2929

30+
find_package(nlohmann_json_schema_validator REQUIRED)
31+
3032
target_link_libraries(unit-tests-handler-pcap
3133
PRIVATE
32-
${CONAN_LIBS_JSON-SCHEMA-VALIDATOR}
34+
nlohmann_json_schema_validator
3335
Visor::Handler::Pcap
3436
Visor::Lib::Test)
3537

src/inputs/dnstap/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ if(NOT WIN32)
3131
set(DNSTAP_ADDITIONAL_LIBS fstrm)
3232
endif()
3333

34+
find_package(uvw REQUIRED)
35+
3436
target_link_libraries(VisorInputDnstap
3537
PUBLIC
3638
${DNSTAP_ADDITIONAL_LIBS}
3739
Visor::Core
3840
Visor::Lib::Utils
39-
${CONAN_LIBS_LIBUV}
40-
${CONAN_LIBS_UVW}
41+
uvw::uvw
4142
)
4243

4344
set(VISOR_STATIC_PLUGINS ${VISOR_STATIC_PLUGINS} Visor::Input::Dnstap PARENT_SCOPE)

src/inputs/flow/CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@ target_include_directories(VisorInputFlow
1414
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
1515
)
1616

17+
find_package(pcapplusplus REQUIRED)
18+
find_package(uvw REQUIRED)
19+
1720
target_link_libraries(VisorInputFlow
1821
PUBLIC
1922
netflow
2023
sflow
2124
Visor::Core
22-
${CONAN_LIBS_LIBUV}
23-
${CONAN_LIBS_UVW}
24-
${CONAN_LIBS_PCAPPLUSPLUS}
25-
${CONAN_LIBS_PTHREADS4W}
26-
${CONAN_LIBS_LIBPCAP}
27-
${CONAN_LIBS_NPCAP}
25+
pcapplusplus::pcapplusplus
26+
uvw::uvw
2827
)
2928

3029
set(VISOR_STATIC_PLUGINS ${VISOR_STATIC_PLUGINS} Visor::Input::Flow PARENT_SCOPE)

0 commit comments

Comments
 (0)