Skip to content

[CMAKE] Add pkg-config support for OpenTelemetry proto installation#4192

Open
owent wants to merge 2 commits into
open-telemetry:mainfrom
owent:add_pkgconfig_for_proto
Open

[CMAKE] Add pkg-config support for OpenTelemetry proto installation#4192
owent wants to merge 2 commits into
open-telemetry:mainfrom
owent:add_pkgconfig_for_proto

Conversation

@owent

@owent owent commented Jun 30, 2026

Copy link
Copy Markdown
Member

Fixes #4182

Changes

  • [CMAKE] Add pkg-config support for OpenTelemetry proto installation

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Copilot AI review requested due to automatic review settings June 30, 2026 10:29
@owent owent requested a review from a team as a code owner June 30, 2026 10:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds pkg-config metadata for the installed OpenTelemetry protobuf/gRPC protobuf libraries so non-CMake consumers can obtain the required -DOPENTELEMETRY_PROTO_API=... compile definition via pkg-config --cflags, addressing the undefined macro issue reported in #4182.

Changes:

  • Add an include guard to the shared cmake/pkgconfig.cmake helper to prevent repeated inclusion.
  • Generate and install opentelemetry_proto.pc (and opentelemetry_proto_grpc.pc when WITH_OTLP_GRPC=ON) during OPENTELEMETRY_INSTALL.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
cmake/pkgconfig.cmake Adds include_guard(GLOBAL) to avoid re-including the pkg-config helper module.
cmake/opentelemetry-proto.cmake Installs generated proto headers and installs new pkg-config .pc files for opentelemetry_proto (+ opentelemetry_proto_grpc when enabled).

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.90%. Comparing base (a56f0e2) to head (ca648f9).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4192      +/-   ##
==========================================
+ Coverage   82.89%   82.90%   +0.02%     
==========================================
  Files         405      405              
  Lines       17292    17292              
==========================================
+ Hits        14332    14334       +2     
+ Misses       2960     2958       -2     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUILD] Installed proto headers contain undefined macro OPENTELEMETRY_PROTO_API

2 participants