Skip to content

Commit bcdea0e

Browse files
dbarkermarcalfflalitb
authored
[CMAKE] add generated protobuf headers to the opentelemetry_proto target (open-telemetry#3400)
* adds the generated protobuf includes to the opentelemetry_proto target instead of using include_directories * add changelog entry --------- Co-authored-by: Marc Alff <[email protected]> Co-authored-by: Lalit Kumar Bhasin <[email protected]>
1 parent 364b860 commit bcdea0e

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ Increment the:
5252
* [BUILD] Upgrade nlohmann_json to 3.12.0
5353
[#3406](https://github.com/open-telemetry/opentelemetry-cpp/pull/3406)
5454

55+
* [CMAKE] Add generated protobuf headers to the opentelemetry_proto target
56+
[#3400](https://github.com/open-telemetry/opentelemetry-cpp/pull/3400)
57+
5558
## [1.20 2025-04-01]
5659

5760
* [BUILD] Update opentelemetry-proto version

cmake/opentelemetry-proto.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ add_custom_command(
290290
COMMENT "[Run]: ${PROTOBUF_RUN_PROTOC_COMMAND}"
291291
DEPENDS ${PROTOBUF_PROTOC_EXECUTABLE})
292292

293-
include_directories("${GENERATED_PROTOBUF_PATH}")
294-
295293
unset(OTELCPP_PROTO_TARGET_OPTIONS)
296294
if(CMAKE_SYSTEM_NAME MATCHES "Windows|MinGW|WindowsStore")
297295
list(APPEND OTELCPP_PROTO_TARGET_OPTIONS STATIC)
@@ -315,6 +313,11 @@ add_library(
315313
${METRICS_SERVICE_PB_CPP_FILE})
316314
set_target_version(opentelemetry_proto)
317315

316+
target_include_directories(
317+
opentelemetry_proto
318+
PUBLIC "$<BUILD_INTERFACE:${GENERATED_PROTOBUF_PATH}>"
319+
"$<INSTALL_INTERFACE:include>")
320+
318321
# Disable include-what-you-use on generated code.
319322
set_target_properties(opentelemetry_proto PROPERTIES CXX_INCLUDE_WHAT_YOU_USE
320323
"")

third_party/nlohmann-json

Submodule nlohmann-json updated 837 files

0 commit comments

Comments
 (0)