Skip to content

Commit 9d62700

Browse files
committed
Avoid looking for protobuf, kafka, grpc if requested
This fixes the issue some people are having when building monitoring without online components (e.g. for analysis), while having protobuf / grpc / abseil on the system for whatever reason. In that scenario, the old behavior results in picking up a potentially incompatible protobuf from the system and consequent build errors. In order to keep backward compatible behavior, I made the options on by default, I will make sure in alidist the correct options are chosen when building a non-dataflow configuration.
1 parent f90781d commit 9d62700

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,16 @@
1616
# General project definition
1717
####################################
1818

19-
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.2 FATAL_ERROR)
19+
CMAKE_MINIMUM_REQUIRED(VERSION 3.27.1 FATAL_ERROR)
2020
set(Boost_USE_STATIC_RUNTIME OFF)
2121
set(Boost_USE_STATIC_LIBS OFF)
2222
set(BUILD_SHARED_LIBS ON)
2323
set(Boost_USE_MULTITHREADED ON)
24+
set(O2_MONITORING_KAFKA_ENABLE ON)
25+
set(O2_MONITORING_CONTROL_ENABLE ON)
2426

2527
# Set cmake policy by version: https://cmake.org/cmake/help/latest/manual/cmake-policies.7.html
26-
if(${CMAKE_VERSION} VERSION_LESS 3.12)
27-
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
28-
else()
29-
cmake_policy(VERSION 3.12)
30-
endif()
28+
cmake_policy(VERSION 3.12)
3129

3230
# Define project
3331
project(Monitoring
@@ -77,8 +75,12 @@ find_package(Boost 1.70 REQUIRED COMPONENTS unit_test_framework program_options
7775
find_package(ApMon MODULE)
7876
find_package(CURL MODULE)
7977
find_package(InfoLogger CONFIG)
80-
find_package(Protobuf CONFIG)
81-
find_package(gRPC CONFIG)
78+
if(O2_MONITORING_KAFKA_ENABLE OR O2_MONITORING_CONTROL_ENABLE)
79+
find_package(Protobuf CONFIG)
80+
endif()
81+
if(O2_MONITORING_CONTROL_ENABLE)
82+
find_package(gRPC CONFIG)
83+
endif()
8284

8385
if(RDKAFKA_ROOT)
8486
message("RDKAFKA_ROOT set, we enable corresponding libs and binaries")

0 commit comments

Comments
 (0)