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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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 26003c4
🔍 Latest deploy log https://app.netlify.com/projects/opentelemetry-cpp-api-docs/deploys/68869b210a0ed30008513c32

Copy link

codecov bot commented Jul 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.01%. Comparing base (dbd0680) to head (26003c4).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3568      +/-   ##
==========================================
- Coverage   90.03%   90.01%   -0.01%     
==========================================
  Files         220      220              
  Lines        7065     7065              
==========================================
- Hits         6360     6359       -1     
- Misses        705      706       +1     

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.

@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.

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