Skip to content

[CMAKE] Don't set iwyu and clang-tidy properties on nlohmann_json with cmake <3.19 #3568

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
merged 2 commits into from
Jul 28, 2025

Conversation

dbarker
Copy link
Member

@dbarker dbarker commented Jul 27, 2025

Fixes #3560

nlohmann_json is an INTERFACE target and CMake <3.19 does not support setting the iwyu and clang-tidy properties on interface targets.

Changes

  • check if the CMake version is >= 3.19 before setting the iwyu and clang-tidy properties on the nlohmann-json target
  • Update the fetch content test in the CI workflow to verify fetching nlohmann-json (and the other fetchable dependencies) with the minimum supported CMake version (3.14).

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 27, 2025

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

Name Link
🔨 Latest commit 35d69e6
🔍 Latest deploy log https://app.netlify.com/projects/opentelemetry-cpp-api-docs/deploys/68875fc06f8bb900086aaf23

Copy link

codecov bot commented Jul 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.03%. Comparing base (4c41390) to head (35d69e6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3568   +/-   ##
=======================================
  Coverage   90.03%   90.03%           
=======================================
  Files         220      220           
  Lines        7069     7069           
=======================================
  Hits         6364     6364           
  Misses        705      705           
🚀 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 27, 2025 21:58
@dbarker dbarker requested a review from a team as a code owner July 27, 2025 21:58
@dbarker dbarker changed the title fix fetching nlohmann_json when cmake version is less than 3.19 [CMAKE] don't set iwyu and clang-tidy properties on nlohmann_json when cmake version is less than 3.19 Jul 27, 2025
@dbarker dbarker changed the title [CMAKE] don't set iwyu and clang-tidy properties on nlohmann_json when cmake version is less than 3.19 [CMAKE] don't set iwyu and clang-tidy properties on nlohmann_json with cmake <3.19 Jul 27, 2025
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, thanks for the fix.

@marcalff marcalff changed the title [CMAKE] don't set iwyu and clang-tidy properties on nlohmann_json with cmake <3.19 [CMAKE] Don't set iwyu and clang-tidy properties on nlohmann_json with cmake <3.19 Jul 27, 2025
@marcalff
Copy link
Member

Note that we may have to upgrade CMake in the future, because

https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md

is now at CMake >= 3.22 since 2025-06-04.

Still, it is good to have this fix in the code base.

@marcalff marcalff merged commit 03e0452 into open-telemetry:main Jul 28, 2025
70 checks passed
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.

CMake configuration on Ubuntu 20.04 fails with v1.22.0
2 participants