Skip to content

[CMake] Fix compile definitions being passed to rootcling as -D-Dxxx. #19030

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

hageboeck
Copy link
Member

@hageboeck hageboeck commented Jun 13, 2025

When passing compile definitions to cling, ROOT unconditionally adds -D. Some projects such as XRootD already have -D in their definition, leading to an error such as:
While building module 'NetxNG':
:4:9: error: macro name must be an identifier #define -D_FILE_OFFSET_BITS 64

The "canonical" way in CMake would be to not have explicit -Ds in the COMPILE_DEFINITIONS property, so we can work around the issue xrootd/xrootd#2543 (fixed in 5.8.4) by overwriting XRootD's COMPILE_DEFINITIONS property.

@hageboeck hageboeck self-assigned this Jun 13, 2025
@hageboeck hageboeck requested a review from bellenot as a code owner June 13, 2025 11:29
Copy link

github-actions bot commented Jun 13, 2025

Test Results

    19 files      19 suites   3d 10h 28m 52s ⏱️
 2 813 tests  2 813 ✅ 0 💤 0 ❌
51 945 runs  51 945 ✅ 0 💤 0 ❌

Results for commit fad0d4b.

♻️ This comment has been updated with latest results.

Up to version 5.8.4, XRootD exports an extra -D in its compile
definitions, which poses a problem when generating the rootcling
commands.
Until the minimum supported version of XRootD is 5.8.4 or higher, this
can be fixed by reading the relevant property and overwriting it with
a string without the "-D"s.
@hageboeck hageboeck force-pushed the cmake_cling_compileDefinition branch from f7291ee to fad0d4b Compare June 16, 2025 15:07
@hageboeck hageboeck requested a review from pcanal June 16, 2025 15:09
Copy link
Member

@pcanal pcanal left a comment

Choose a reason for hiding this comment

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

Thanks.

@hageboeck hageboeck merged commit edd2026 into root-project:master Jun 17, 2025
24 checks passed
@hageboeck hageboeck deleted the cmake_cling_compileDefinition branch June 17, 2025 08:56
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.

2 participants