From 67bf8c7674b5df2de3ea77b34fc090e6bb4175bf Mon Sep 17 00:00:00 2001 From: WenTao Ou Date: Sat, 15 Apr 2023 18:48:41 +0800 Subject: [PATCH 1/9] Allow build shared `opentelemetry_proto` on non-Windows platform. Signed-off-by: WenTao Ou --- cmake/opentelemetry-proto.cmake | 44 +++++++++++++++------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index 1aa1ba0349..9efe73ebf3 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -229,33 +229,29 @@ endif() include_directories("${GENERATED_PROTOBUF_PATH}") +unset(OTELCPP_PROTO_TARGET_OPTIONS) +if(CMAKE_SYSTEM_NAME MATCHES "Windows|MinGW|WindowsStore") + list(APPEND OTELCPP_PROTO_TARGET_OPTIONS STATIC) +endif() + +list( + APPEND + OTELCPP_PROTO_TARGET_OPTIONS + ${COMMON_PB_CPP_FILE} + ${RESOURCE_PB_CPP_FILE} + ${TRACE_PB_CPP_FILE} + ${LOGS_PB_CPP_FILE} + ${METRICS_PB_CPP_FILE} + ${TRACE_SERVICE_PB_CPP_FILE} + ${LOGS_SERVICE_PB_CPP_FILE} + ${METRICS_SERVICE_PB_CPP_FILE}) if(WITH_OTLP_GRPC) - add_library( - opentelemetry_proto STATIC - ${COMMON_PB_CPP_FILE} - ${RESOURCE_PB_CPP_FILE} - ${TRACE_PB_CPP_FILE} - ${LOGS_PB_CPP_FILE} - ${METRICS_PB_CPP_FILE} - ${TRACE_SERVICE_PB_CPP_FILE} - ${TRACE_SERVICE_GRPC_PB_CPP_FILE} - ${LOGS_SERVICE_PB_CPP_FILE} - ${LOGS_SERVICE_GRPC_PB_CPP_FILE} - ${METRICS_SERVICE_PB_CPP_FILE} - ${METRICS_SERVICE_GRPC_PB_CPP_FILE}) -else() - add_library( - opentelemetry_proto STATIC - ${COMMON_PB_CPP_FILE} - ${RESOURCE_PB_CPP_FILE} - ${TRACE_PB_CPP_FILE} - ${LOGS_PB_CPP_FILE} - ${METRICS_PB_CPP_FILE} - ${TRACE_SERVICE_PB_CPP_FILE} - ${LOGS_SERVICE_PB_CPP_FILE} - ${METRICS_SERVICE_PB_CPP_FILE}) + list(APPEND OTELCPP_PROTO_TARGET_OPTIONS ${TRACE_SERVICE_GRPC_PB_CPP_FILE} + ${LOGS_SERVICE_GRPC_PB_CPP_FILE} ${METRICS_SERVICE_GRPC_PB_CPP_FILE}) endif() +add_library(opentelemetry_proto ${OTELCPP_PROTO_TARGET_OPTIONS}) + if(needs_proto_download) add_dependencies(opentelemetry_proto opentelemetry-proto) endif() From ea7d86c4ebb39f986c1d88c013de25b973e23ce6 Mon Sep 17 00:00:00 2001 From: WenTao Ou Date: Sat, 15 Apr 2023 19:50:36 +0800 Subject: [PATCH 2/9] Fix proto linking. Signed-off-by: WenTao Ou --- CHANGELOG.md | 2 ++ cmake/opentelemetry-proto.cmake | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d026dcdd6..cdfe80d1ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ Increment the: * [BUILD] Build break with old curl, macro CURL_VERSION_BITS unknown [#2102](https://github.com/open-telemetry/opentelemetry-cpp/pull/2102) +* [BUILD] Allow build shared opentelemetry_proto on non-Windows platform. + [#2097](https://github.com/open-telemetry/opentelemetry-cpp/pull/2097) Deprecations: diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index 9efe73ebf3..d6e9e1831c 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -278,7 +278,17 @@ if(TARGET protobuf::libprotobuf) else() # cmake 3.8 or lower target_include_directories(opentelemetry_proto PUBLIC ${Protobuf_INCLUDE_DIRS}) - target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES}) + target_link_libraries(opentelemetry_proto PUBLIC ${Protobuf_LIBRARIES}) +endif() + +if(WITH_OTLP_GRPC) + if(WITH_ABSEIL) + find_package(absl CONFIG) + if(TARGET absl::synchronization) + target_link_libraries(opentelemetry_proto INTERFACE absl::synchronization) + endif() + endif() + target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) endif() if(BUILD_SHARED_LIBS) From c5ea45d8ea62b5a2d1cb3677eb5e7fa9e0fbbed7 Mon Sep 17 00:00:00 2001 From: WenTao Ou Date: Sun, 16 Apr 2023 22:24:49 +0800 Subject: [PATCH 3/9] Fix gRPC linking on ELF ABI. Signed-off-by: WenTao Ou --- cmake/opentelemetry-proto.cmake | 7 +++++-- exporters/otlp/CMakeLists.txt | 26 +++++++++++++++++--------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index d6e9e1831c..4e7b1de56c 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -232,6 +232,10 @@ include_directories("${GENERATED_PROTOBUF_PATH}") unset(OTELCPP_PROTO_TARGET_OPTIONS) if(CMAKE_SYSTEM_NAME MATCHES "Windows|MinGW|WindowsStore") list(APPEND OTELCPP_PROTO_TARGET_OPTIONS STATIC) +elseif(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) + list(APPEND OTELCPP_PROTO_TARGET_OPTIONS SHARED) +else() + list(APPEND OTELCPP_PROTO_TARGET_OPTIONS STATIC) endif() list( @@ -285,10 +289,9 @@ if(WITH_OTLP_GRPC) if(WITH_ABSEIL) find_package(absl CONFIG) if(TARGET absl::synchronization) - target_link_libraries(opentelemetry_proto INTERFACE absl::synchronization) + target_link_libraries(opentelemetry_proto PRIVATE absl::synchronization) endif() endif() - target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) endif() if(BUILD_SHARED_LIBS) diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index eed80783ac..a69ab55f7f 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -15,9 +15,6 @@ target_include_directories( "$") set(OPENTELEMETRY_OTLP_TARGETS opentelemetry_otlp_recordable) -target_link_libraries( - opentelemetry_otlp_recordable - PUBLIC opentelemetry_trace opentelemetry_resources opentelemetry_proto) if(WITH_LOGS_PREVIEW) target_link_libraries(opentelemetry_otlp_recordable PUBLIC opentelemetry_logs) @@ -25,7 +22,14 @@ endif() target_link_libraries(opentelemetry_otlp_recordable PUBLIC opentelemetry_metrics) +set(OPENTELEMETRY_PROTO_LINK_NAME opentelemetry_proto) if(WITH_OTLP_GRPC) + # Because opentelemetry_proto may depend on gRPC, and gRPC can only be linked + # in one dynamic library or executable (otherwise, there may be conflicts with + # some global variables in certain versions of gRPC), we have switched the + # link for opentelemetry_exporter_otlp_grpc_client into all targets that + # depend on opentelemetry_proto. + set(OPENTELEMETRY_PROTO_LINK_NAME opentelemetry_exporter_otlp_grpc_client) find_package(gRPC REQUIRED) add_library(opentelemetry_exporter_otlp_grpc_client src/otlp_grpc_client.cc src/otlp_grpc_utils.cc) @@ -33,10 +37,9 @@ if(WITH_OTLP_GRPC) PROPERTIES EXPORT_NAME otlp_grpc_client) target_link_libraries( opentelemetry_exporter_otlp_grpc_client - PUBLIC opentelemetry_sdk opentelemetry_ext opentelemetry_proto) - - target_link_libraries(opentelemetry_exporter_otlp_grpc_client - PRIVATE gRPC::grpc++) + PUBLIC opentelemetry_sdk opentelemetry_ext + # gRPC::grpc++ must be linked before opentelemetry_proto. + opentelemetry_proto gRPC::grpc++) get_target_property(GRPC_INCLUDE_DIRECTORY gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES) if(GRPC_INCLUDE_DIRECTORY) @@ -102,8 +105,8 @@ if(WITH_OTLP_HTTP) PROPERTIES EXPORT_NAME otlp_http_client) target_link_libraries( opentelemetry_exporter_otlp_http_client - PUBLIC opentelemetry_sdk opentelemetry_proto opentelemetry_http_client_curl - nlohmann_json::nlohmann_json) + PUBLIC opentelemetry_sdk ${OPENTELEMETRY_PROTO_LINK_NAME} + opentelemetry_http_client_curl nlohmann_json::nlohmann_json) if(nlohmann_json_clone) add_dependencies(opentelemetry_exporter_otlp_http_client nlohmann_json::nlohmann_json) @@ -162,6 +165,11 @@ if(WITH_OTLP_HTTP) opentelemetry_exporter_otlp_http_metric) endif() +target_link_libraries( + opentelemetry_otlp_recordable + PUBLIC opentelemetry_trace opentelemetry_resources + ${OPENTELEMETRY_PROTO_LINK_NAME}) + if(OPENTELEMETRY_INSTALL) install( TARGETS ${OPENTELEMETRY_OTLP_TARGETS} From 643fdfb7f2cb36585198b88e55bf25eebcd76045 Mon Sep 17 00:00:00 2001 From: WenTao Ou Date: Sun, 16 Apr 2023 22:41:21 +0800 Subject: [PATCH 4/9] Add `opentelemetry_proto_grpc` to make OTLP HTTP do not depends gRPC. Signed-off-by: WenTao Ou --- cmake/opentelemetry-proto.cmake | 32 ++++++++++++++++++++++---------- exporters/otlp/CMakeLists.txt | 24 +++++++++++------------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index 4e7b1de56c..efaaccbb09 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -238,9 +238,11 @@ else() list(APPEND OTELCPP_PROTO_TARGET_OPTIONS STATIC) endif() -list( - APPEND - OTELCPP_PROTO_TARGET_OPTIONS +list(APPEND OTELCPP_PROTO_TARGET_OPTIONS) + +set(OPENTELEMETRY_PROTO_TARGETS opentelemetry_proto) +add_library( + opentelemetry_proto ${COMMON_PB_CPP_FILE} ${RESOURCE_PB_CPP_FILE} ${TRACE_PB_CPP_FILE} @@ -249,12 +251,20 @@ list( ${TRACE_SERVICE_PB_CPP_FILE} ${LOGS_SERVICE_PB_CPP_FILE} ${METRICS_SERVICE_PB_CPP_FILE}) + if(WITH_OTLP_GRPC) - list(APPEND OTELCPP_PROTO_TARGET_OPTIONS ${TRACE_SERVICE_GRPC_PB_CPP_FILE} - ${LOGS_SERVICE_GRPC_PB_CPP_FILE} ${METRICS_SERVICE_GRPC_PB_CPP_FILE}) -endif() + add_library( + opentelemetry_proto_grpc + ${TRACE_SERVICE_GRPC_PB_CPP_FILE} ${LOGS_SERVICE_GRPC_PB_CPP_FILE} + ${METRICS_SERVICE_GRPC_PB_CPP_FILE}) -add_library(opentelemetry_proto ${OTELCPP_PROTO_TARGET_OPTIONS}) + list(APPEND OPENTELEMETRY_PROTO_TARGETS opentelemetry_proto_grpc) + target_link_libraries(opentelemetry_proto_grpc PUBLIC opentelemetry_proto) + + set_target_properties(opentelemetry_proto_grpc PROPERTIES EXPORT_NAME + proto_grpc) + patch_protobuf_targets(opentelemetry_proto_grpc) +endif() if(needs_proto_download) add_dependencies(opentelemetry_proto opentelemetry-proto) @@ -264,7 +274,7 @@ patch_protobuf_targets(opentelemetry_proto) if(OPENTELEMETRY_INSTALL) install( - TARGETS opentelemetry_proto + TARGETS ${OPENTELEMETRY_PROTO_TARGETS} EXPORT "${PROJECT_NAME}-target" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -289,11 +299,13 @@ if(WITH_OTLP_GRPC) if(WITH_ABSEIL) find_package(absl CONFIG) if(TARGET absl::synchronization) - target_link_libraries(opentelemetry_proto PRIVATE absl::synchronization) + target_link_libraries(opentelemetry_proto_grpc PRIVATE absl::synchronization) endif() endif() endif() if(BUILD_SHARED_LIBS) - set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON) + foreach(proto_target ${OPENTELEMETRY_PROTO_TARGETS}) + set_property(TARGET proto_target PROPERTY POSITION_INDEPENDENT_CODE ON) + endforeach() endif() diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index a69ab55f7f..3d3d123300 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -22,24 +22,23 @@ endif() target_link_libraries(opentelemetry_otlp_recordable PUBLIC opentelemetry_metrics) -set(OPENTELEMETRY_PROTO_LINK_NAME opentelemetry_proto) if(WITH_OTLP_GRPC) - # Because opentelemetry_proto may depend on gRPC, and gRPC can only be linked - # in one dynamic library or executable (otherwise, there may be conflicts with - # some global variables in certain versions of gRPC), we have switched the - # link for opentelemetry_exporter_otlp_grpc_client into all targets that - # depend on opentelemetry_proto. - set(OPENTELEMETRY_PROTO_LINK_NAME opentelemetry_exporter_otlp_grpc_client) find_package(gRPC REQUIRED) add_library(opentelemetry_exporter_otlp_grpc_client src/otlp_grpc_client.cc src/otlp_grpc_utils.cc) set_target_properties(opentelemetry_exporter_otlp_grpc_client PROPERTIES EXPORT_NAME otlp_grpc_client) + + # Because opentelemetry_proto_grpc depends on gRPC, and gRPC can only be + # linked in one dynamic library or executable (otherwise, there may be + # conflicts with some global variables in certain versions of gRPC), we have + # switched the link for opentelemetry_exporter_otlp_grpc_client into all + # targets that depend on opentelemetry_proto_grpc. target_link_libraries( opentelemetry_exporter_otlp_grpc_client PUBLIC opentelemetry_sdk opentelemetry_ext - # gRPC::grpc++ must be linked before opentelemetry_proto. - opentelemetry_proto gRPC::grpc++) + # gRPC::grpc++ must be linked before opentelemetry_proto_grpc. + opentelemetry_proto_grpc gRPC::grpc++) get_target_property(GRPC_INCLUDE_DIRECTORY gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES) if(GRPC_INCLUDE_DIRECTORY) @@ -105,8 +104,8 @@ if(WITH_OTLP_HTTP) PROPERTIES EXPORT_NAME otlp_http_client) target_link_libraries( opentelemetry_exporter_otlp_http_client - PUBLIC opentelemetry_sdk ${OPENTELEMETRY_PROTO_LINK_NAME} - opentelemetry_http_client_curl nlohmann_json::nlohmann_json) + PUBLIC opentelemetry_sdk opentelemetry_proto opentelemetry_http_client_curl + nlohmann_json::nlohmann_json) if(nlohmann_json_clone) add_dependencies(opentelemetry_exporter_otlp_http_client nlohmann_json::nlohmann_json) @@ -167,8 +166,7 @@ endif() target_link_libraries( opentelemetry_otlp_recordable - PUBLIC opentelemetry_trace opentelemetry_resources - ${OPENTELEMETRY_PROTO_LINK_NAME}) + PUBLIC opentelemetry_trace opentelemetry_resources opentelemetry_proto) if(OPENTELEMETRY_INSTALL) install( From 69860c82c5aa267220ac6470d8f9fffb270e7306 Mon Sep 17 00:00:00 2001 From: owent Date: Mon, 17 Apr 2023 10:17:59 +0800 Subject: [PATCH 5/9] Fix `set_property` for proto targets. Signed-off-by: owent --- cmake/opentelemetry-proto.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index efaaccbb09..7f9249e31d 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -299,13 +299,14 @@ if(WITH_OTLP_GRPC) if(WITH_ABSEIL) find_package(absl CONFIG) if(TARGET absl::synchronization) - target_link_libraries(opentelemetry_proto_grpc PRIVATE absl::synchronization) + target_link_libraries(opentelemetry_proto_grpc + PRIVATE absl::synchronization) endif() endif() endif() if(BUILD_SHARED_LIBS) foreach(proto_target ${OPENTELEMETRY_PROTO_TARGETS}) - set_property(TARGET proto_target PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET ${proto_target} PROPERTY POSITION_INDEPENDENT_CODE ON) endforeach() endif() From fb1d6c107843b5bf8edd992cbb97629c8c50f1c7 Mon Sep 17 00:00:00 2001 From: owent Date: Mon, 17 Apr 2023 15:15:20 +0800 Subject: [PATCH 6/9] gRPC should be private linked. Signed-off-by: owent --- exporters/otlp/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index 3d3d123300..be264d7978 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -38,7 +38,8 @@ if(WITH_OTLP_GRPC) opentelemetry_exporter_otlp_grpc_client PUBLIC opentelemetry_sdk opentelemetry_ext # gRPC::grpc++ must be linked before opentelemetry_proto_grpc. - opentelemetry_proto_grpc gRPC::grpc++) + opentelemetry_proto_grpc + PRIVATE gRPC::grpc++) get_target_property(GRPC_INCLUDE_DIRECTORY gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES) if(GRPC_INCLUDE_DIRECTORY) From 679b8cf31dc53237582076072597ba382008165d Mon Sep 17 00:00:00 2001 From: owent Date: Tue, 9 May 2023 14:16:27 +0800 Subject: [PATCH 7/9] Correct the usage mistake of `OTELCPP_PROTO_TARGET_OPTIONS` when merging. Signed-off-by: owent --- cmake/opentelemetry-proto.cmake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index 7f9249e31d..1e5abec516 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -238,11 +238,10 @@ else() list(APPEND OTELCPP_PROTO_TARGET_OPTIONS STATIC) endif() -list(APPEND OTELCPP_PROTO_TARGET_OPTIONS) - set(OPENTELEMETRY_PROTO_TARGETS opentelemetry_proto) add_library( opentelemetry_proto + ${OTELCPP_PROTO_TARGET_OPTIONS} ${COMMON_PB_CPP_FILE} ${RESOURCE_PB_CPP_FILE} ${TRACE_PB_CPP_FILE} @@ -255,8 +254,8 @@ add_library( if(WITH_OTLP_GRPC) add_library( opentelemetry_proto_grpc - ${TRACE_SERVICE_GRPC_PB_CPP_FILE} ${LOGS_SERVICE_GRPC_PB_CPP_FILE} - ${METRICS_SERVICE_GRPC_PB_CPP_FILE}) + ${OTELCPP_PROTO_TARGET_OPTIONS} ${TRACE_SERVICE_GRPC_PB_CPP_FILE} + ${LOGS_SERVICE_GRPC_PB_CPP_FILE} ${METRICS_SERVICE_GRPC_PB_CPP_FILE}) list(APPEND OPENTELEMETRY_PROTO_TARGETS opentelemetry_proto_grpc) target_link_libraries(opentelemetry_proto_grpc PUBLIC opentelemetry_proto) From 9ab0f59349d23c7ddb57e2692ddfa13370b17eb2 Mon Sep 17 00:00:00 2001 From: owent Date: Wed, 10 May 2023 11:21:22 +0800 Subject: [PATCH 8/9] Add break changelog for proto_grpc Signed-off-by: owent --- CHANGELOG.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cad801bec5..d7c7f88120 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,11 +19,22 @@ Increment the: [#2123](https://github.com/open-telemetry/opentelemetry-cpp/pull/2123) * [BUILD] Build break with old curl, macro CURL_VERSION_BITS unknown [#2102](https://github.com/open-telemetry/opentelemetry-cpp/pull/2102) -* [BUILD] Allow build shared opentelemetry_proto on non-Windows platform. +* [BUILD] Add opentelemetry_proto_grpc and allow build shared opentelemetry_proto + and opentelemetry_proto_grpc on non-Windows platform. [#2097](https://github.com/open-telemetry/opentelemetry-cpp/pull/2097) * [API] Add user facing Logging API and Benchmarks [#2094](https://github.com/open-telemetry/opentelemetry-cpp/pull/2094) +Breaking changes: + +* Add opentelemetry_proto_grpc and move gRPC sources into it. + [#2097](https://github.com/open-telemetry/opentelemetry-cpp/pull/2097) + * There will be no breaking changes for users who only use OTLP exporters and + do not directly use opentelemetry-cpp::proto. However, it is important to + note that `opentelemetry-cpp::proto` no longer contains generated gRPC codes + , and all components that depend on these gRPC codes should also link to + `opentelemetry-cpp::proto_grpc`. + Deprecations: * The Jaeger Exporter is deprecated, see [DEPRECATED](./DEPRECATED.md) for details. From bfbe3450ecce0c82066ef11e7e442d5093f85331 Mon Sep 17 00:00:00 2001 From: owent Date: Wed, 17 May 2023 15:25:10 +0800 Subject: [PATCH 9/9] Include gRPC's include directories for `opentelemetry_proto_grpc`. Signed-off-by: owent --- cmake/opentelemetry-proto.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index 1e5abec516..34b33d3cff 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -263,6 +263,13 @@ if(WITH_OTLP_GRPC) set_target_properties(opentelemetry_proto_grpc PROPERTIES EXPORT_NAME proto_grpc) patch_protobuf_targets(opentelemetry_proto_grpc) + get_target_property(GRPC_INCLUDE_DIRECTORY gRPC::grpc++ + INTERFACE_INCLUDE_DIRECTORIES) + if(GRPC_INCLUDE_DIRECTORY) + target_include_directories( + opentelemetry_proto_grpc + PUBLIC "$") + endif() endif() if(needs_proto_download)