Skip to content

Define minimum C++ version using ROOT_CXX_STANDARD#1700

Merged
KrisThielemans merged 7 commits intoUCL:masterfrom
denproc:feat_use_root_cxx_standard
Apr 17, 2026
Merged

Define minimum C++ version using ROOT_CXX_STANDARD#1700
KrisThielemans merged 7 commits intoUCL:masterfrom
denproc:feat_use_root_cxx_standard

Conversation

@denproc
Copy link
Copy Markdown
Contributor

@denproc denproc commented Apr 1, 2026

Changes in this pull request

Adjusted CMake recipe to define minimum C++ version using ROOT_CXX_STANDARD.

Testing performed

The definition of the build variables has been tested on MacOS for root==6.28,6.30,6.32.
However, I could not validate if it builds successfully due to conflict of dependencies between root, STIR, and libparallelproj=2 (conda installations).

Related issues

Fixes #1677

Checklist before requesting a review

  • I have performed a self-review of my code
  • The code builds and runs on my machine
  • documentation/release_XXX.md has been updated with any functionality change (if applicable)

Contribution Notes

Please tick the following:

  • The content of this Pull Request (the Contribution) is intentionally submitted for inclusion in STIR (the Work) under the terms and conditions of the Apache-2.0 License.

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 1, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

Comment thread CMakeLists.txt Outdated
@KrisThielemans KrisThielemans self-assigned this Apr 1, 2026
@KrisThielemans KrisThielemans added this to the v6.4 milestone Apr 1, 2026
Copy link
Copy Markdown
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

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

possibly still add a quick line in the release notes ("If CERN ROOT is used, set minimum C++ standard from its ROOT_CXX_STANDARD variable, if it exists."

Comment thread CMakeLists.txt Outdated
Remove unnecessary endif() for CERN_ROOT_FOUND condition.
@KrisThielemans
Copy link
Copy Markdown
Collaborator

Why draft? If the tests work, I'm fine to merge.

@denproc
Copy link
Copy Markdown
Contributor Author

denproc commented Apr 1, 2026

I proposed conditional upgrade as the minimum C++17 was set in the snippet below. However, I agree without condition it look more clean, while at config stage it costs nothing to reset it back to version 17.

UseCXX(17)

My inital idea for draft was to give me some time to test the build with ROOT installed.
However, it's not that straghtforward as I expected due to the conflict between dependencies.

Let's merge this PR as it shouldn't affect the use cases, where ROOT is not used. Any compatibility problems, when builiding STIR with ROOT installed, could be addressed as separate issue.

@denproc denproc marked this pull request as ready for review April 1, 2026 23:36
@denproc denproc marked this pull request as draft April 2, 2026 00:06
@denproc
Copy link
Copy Markdown
Contributor Author

denproc commented Apr 2, 2026

Switching back to draft as currently it fails for standalone ROOT install.

@denproc denproc marked this pull request as ready for review April 16, 2026 13:17
@denproc
Copy link
Copy Markdown
Contributor Author

denproc commented Apr 16, 2026

Hi @KrisThielemans,

I have updated the PR.
Tested on macOS with ROOT 6.28, 6.30, and 6.32, using both find_package(ROOT) and ROOTSYS + root-config.

Previously, ROOT >= 6.30 was assumed to require C++20. However, pre-built ROOT distributions (including conda) use C++17 by default. I therefore propose using C++17 as the default for ROOT < 6.32.
For custom ROOT builds using a different C++ standard, the user should set CMAKE_CXX_STANDARD manually.

Copy link
Copy Markdown
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

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

suggestions for the release notes. I'm fine with the code itself. (Please commit changes with [ci skip])

Comment thread documentation/release_6.4.htm Outdated
Comment thread documentation/release_6.4.htm Outdated
Comment thread documentation/release_6.4.htm Outdated
Co-authored-by: Kris Thielemans <KrisThielemans@users.noreply.github.com>
@KrisThielemans KrisThielemans merged commit a4fb6bb into UCL:master Apr 17, 2026
@KrisThielemans
Copy link
Copy Markdown
Collaborator

Thanks!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use ROOT_CXX_STANDARD

2 participants