Skip to content

[INSTALL] Resolve dependencies in opentelemetry-cpp-config.cmake#3094

Merged
marcalff merged 4 commits into
open-telemetry:mainfrom
tobim:cmake-config-find-dependencies
Oct 30, 2024
Merged

[INSTALL] Resolve dependencies in opentelemetry-cpp-config.cmake#3094
marcalff merged 4 commits into
open-telemetry:mainfrom
tobim:cmake-config-find-dependencies

Conversation

@tobim

@tobim tobim commented Oct 12, 2024

Copy link
Copy Markdown
Contributor

Before this change, consumers of the exported CMake targets had to know which dependencies are needed to get the transitive target dependencies like absl::*, gRPC::grpc++, or protobuf::libprotobuf.

Fixes # (issue)

Changes

Please provide a brief description of the changes here.

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

Before this change, consumers of the exported CMake targets had to know
which dependencies are needed to get the transitive target dependencies
like `absl::*`, `gRPC::grpc++`, or `protobuf::libprotobuf`.
@tobim tobim requested a review from a team as a code owner October 12, 2024 12:23
@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 12, 2024

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

@netlify

netlify Bot commented Oct 12, 2024

Copy link
Copy Markdown

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit 7225046
🔍 Latest deploy log https://app.netlify.com/sites/opentelemetry-cpp-api-docs/deploys/67211cfe9f75e50009cc4ab5

@codecov

codecov Bot commented Oct 13, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.91%. Comparing base (497eaf4) to head (7225046).
Report is 150 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3094      +/-   ##
==========================================
+ Coverage   87.12%   87.91%   +0.79%     
==========================================
  Files         200      195       -5     
  Lines        6109     6133      +24     
==========================================
+ Hits         5322     5391      +69     
+ Misses        787      742      -45     

see 98 files with indirect coverage changes

@owent

owent commented Oct 14, 2024

Copy link
Copy Markdown
Member

find_package will produce warning when it's called recursively.
Shoud we just add warnings to let users call find_package for dependencies before otel-cpp?

@tobim

tobim commented Oct 14, 2024

Copy link
Copy Markdown
Contributor Author

find_package will produce warning when it's called recursively.

What warnings? Calling find_package or find_dependency in config files is standard practice.

@tobim

tobim commented Oct 22, 2024

Copy link
Copy Markdown
Contributor Author

I now realize that my earlier response might has come across as rude, which I did not intend.
Please take a look at the docs for find_dependency here.
Quoting:

It is designed to be used in a Package Configuration File (<PackageName>Config.cmake).

May I humbly request that you take another look?

@owent

owent commented Oct 24, 2024

Copy link
Copy Markdown
Member

find_package will produce warning when it's called recursively.

What warnings? Calling find_package or find_dependency in config files is standard practice.

Sorry, calling find_package recursively with FindXXX.cmake will produce warnings, but won't with CONFIG package. Could you please also add find_dependency for OpenTracing, prometheus-cpp, CURL and ZLIB ?

Now we also resolve `OpenTracing`, and `prometheus-cpp`.

If necessary, `CURL` and `ZLIB` are also resolved.
@tobim

tobim commented Oct 26, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for the heads-up! I added the rest.
Afaics CURL and ZLIB are only necessary when opentelemetry_http_client_curl is built as a static library, so I guarded that with NOT BUILD_SHARED_LIBS.

@owent owent left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks

Comment thread cmake/opentelemetry-cpp-config.cmake.in
find_dependency(Threads)

if(@WITH_ABSEIL@)
find_dependency(absl)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I add absl in #3041 , which alos consider protobuf's version and gRpc

@marcalff marcalff added the ok-to-merge The PR is ok to merge (has two approves or raised by a maintainer/approver and has one approve) label Oct 30, 2024
@marcalff marcalff changed the title Resolve dependencies in opentelemetry-cpp-config.cmake [INSTALL] Resolve dependencies in opentelemetry-cpp-config.cmake Oct 30, 2024
@marcalff marcalff merged commit 6292a6a into open-telemetry:main Oct 30, 2024
@tobim tobim deleted the cmake-config-find-dependencies branch October 30, 2024 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-merge The PR is ok to merge (has two approves or raised by a maintainer/approver and has one approve)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants