Skip to content

Commit 1377fa3

Browse files
committed
add build interface link to absl
1 parent 341ec8e commit 1377fa3

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ project(opentelemetry-cpp)
3737
mark_as_advanced(CMAKE_TOOLCHAIN_FILE)
3838

3939
# Prefer cmake CONFIG to auto resolve dependencies.
40+
# This is important to properly find protobuf versions 3.22.0 and above
4041
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
4142

4243
# Don't use customized cmake modules if vcpkg is used to resolve dependence.
@@ -418,12 +419,13 @@ endif()
418419
if(WITH_OTLP_GRPC
419420
OR WITH_OTLP_HTTP
420421
OR WITH_OTLP_FILE)
422+
421423
find_package(Protobuf)
422424
# Protobuf 3.22 or upper require abseil-cpp, we can find it in
423425
# opentelemetry-cpp-config.cmake
424426

425427
if(WITH_OTLP_GRPC)
426-
find_package(gRPC)
428+
find_package(gRPC CONFIG)
427429
endif()
428430
if((NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND) OR (WITH_OTLP_GRPC
429431
AND NOT gRPC_FOUND))
@@ -442,7 +444,7 @@ if(WITH_OTLP_GRPC
442444
find_package(Protobuf REQUIRED)
443445
endif()
444446
if(NOT gRPC_FOUND AND WITH_OTLP_GRPC)
445-
find_package(gRPC)
447+
find_package(gRPC CONFIG)
446448
endif()
447449
if(WIN32)
448450
# Always use x64 protoc.exe

cmake/opentelemetry-proto.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,14 @@ else() # cmake 3.8 or lower
397397
target_link_libraries(opentelemetry_proto PUBLIC ${Protobuf_LIBRARIES})
398398
endif()
399399

400+
# this is needed on some older grcp versions specifically conan recipe for grpc/1.54.3
401+
if(WITH_OTLP_GRPC)
402+
if(TARGET absl::synchronization)
403+
target_link_libraries(opentelemetry_proto_grpc
404+
PUBLIC "$<BUILD_INTERFACE:absl::synchronization>")
405+
endif()
406+
endif()
407+
400408
if(BUILD_SHARED_LIBS)
401409
foreach(proto_target ${OPENTELEMETRY_PROTO_TARGETS})
402410
set_property(TARGET ${proto_target} PROPERTY POSITION_INDEPENDENT_CODE ON)

0 commit comments

Comments
 (0)