diff --git a/CHANGELOG.md b/CHANGELOG.md index ab2db27c85..82eaf5a2ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,9 @@ Increment the: * [BUILD] Upgrade nlohmann_json to 3.12.0 [#3406](https://github.com/open-telemetry/opentelemetry-cpp/pull/3406) +* [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 diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index 246a41e5d5..60b3472845 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 "")