Skip to content

[CMAKE] find or fetch nlohmann-json #3523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

dbarker
Copy link
Member

@dbarker dbarker commented Jul 7, 2025

Fixes #3190

  • The otlp targets no longer have a public dependency on nlohmann-json targets.

Fixes #1448

  • nlohmann-json will now be fetched and install if 1) a nlohmann-json package was not found and 2) OPENTELEMETRY_INSTALL=ON

Changes

  • Update cmake/nlohmann-json.cmake to support finding an installed package or using FetchContent on the git submodule or github repo.
  • Removes the nlohmann_json_clone target (from the ExternalProject approach) and any dependencies on it.

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

Copy link

netlify bot commented Jul 7, 2025

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

Name Link
🔨 Latest commit 16130bb
🔍 Latest deploy log https://app.netlify.com/projects/opentelemetry-cpp-api-docs/deploys/686c0e89ee4e1e000878f21b

Copy link

codecov bot commented Jul 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.96%. Comparing base (711625f) to head (16130bb).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3523   +/-   ##
=======================================
  Coverage   89.96%   89.96%           
=======================================
  Files         219      219           
  Lines        7051     7051           
=======================================
  Hits         6343     6343           
  Misses        708      708           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbarker dbarker marked this pull request as ready for review July 7, 2025 18:40
@dbarker dbarker requested a review from a team as a code owner July 7, 2025 18:40
Copy link
Member

@owent owent left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

LGTM

@marcalff marcalff merged commit 3eec22c into open-telemetry:main Jul 8, 2025
70 checks passed
@dbarker dbarker deleted the cmake_find_or_fetch_nlohmann_json branch July 8, 2025 14:50
malkia added a commit to malkia/opentelemetry-cpp that referenced this pull request Jul 8, 2025
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.

nlohmann_json not found when used opentelemetry-cpp as external project nlohmann_json fails to install to /usr/local during build
3 participants