From 39d7c2ecddd2a70d760189fae5d680e641ead92a Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Sun, 11 May 2025 12:50:38 -0600 Subject: [PATCH 1/2] adds the generated protobuf includes to the opentelemetry_proto target instead of using include_directories --- cmake/opentelemetry-proto.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index d88f66966e..4b80df5974 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -290,8 +290,6 @@ add_custom_command( COMMENT "[Run]: ${PROTOBUF_RUN_PROTOC_COMMAND}" DEPENDS ${PROTOBUF_PROTOC_EXECUTABLE}) -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) @@ -315,6 +313,11 @@ add_library( ${METRICS_SERVICE_PB_CPP_FILE}) set_target_version(opentelemetry_proto) +target_include_directories( + opentelemetry_proto + PUBLIC "$" + "$") + # Disable include-what-you-use on generated code. set_target_properties(opentelemetry_proto PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "") From caf61d561477c6fd986270516377f30eaccc5175 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Sun, 11 May 2025 18:26:43 -0600 Subject: [PATCH 2/2] add changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7180b4aec..3bbaa4aef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,9 @@ Increment the: * [SDK] Aggregate identical metrics instruments and detect duplicates [#3358](https://github.com/open-telemetry/opentelemetry-cpp/pull/3358) +* [CMAKE] Add generated protobuf headers to the opentelemetry_proto target + [#3400](https://github.com/open-telemetry/opentelemetry-cpp/pull/3400) + ## [1.20 2025-04-01] * [BUILD] Update opentelemetry-proto version