Skip to content
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

[v624][cmake] Protect against empty COMPILE_DEFINITIONS in genreflex and rootcint commands #12712

Merged

Conversation

guitargeek
Copy link
Contributor

Backport of these three PRs to ROOT 6.24:

  1. [cmake] Protect against empty COMPILE_DEFINITIONS in rootcint command #11111
  2. [cmake] Protect against empty COMPILE_DEFINITIONS in genreflex command #11408
  3. [cmake] Correct typo in REFLEX_GENERATE_DICTIONARY.  #11462

Like this, I can build the ROOT 6.24 branch in my Arch Linux environment again to debug some RooFit stuff.

guitargeek and others added 3 commits April 25, 2023 11:09
In the `rootcint` command defined in `RootMacros.cmake`, the
`COMPILE_DEFINITIONS` from the target are forwarded as compiler flags.

The `COMPILE_DEFINITIONS` are stored in the `module_defs` variable with
a generator expression:

```
set(module_defs $<TARGET_PROPERTY:${ARG_MODULE},COMPILE_DEFINITIONS>)
```

Then, the definitions are added to the rootcint command with this
expression:

```
"$<$<BOOL:${module_defs}>:-D$<JOIN:${module_defs},;-D>>"
```

This code was almost copied exactly from the CMake documentation
example:

https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html

In particular, the `BOOL` check makes sure that the if the target
property is empty, we will not get a bare `-D` with nothing after it,
corrupting the rootcint command.

However, there is no protextion against the case where the
`COMPILE_DEFINITIONS` target property is not empty, but its elements are
empty strings! This happened to me in my recent build.

Instead of trying to figure out where the empty strings are added to the
`COMPILE_DEFINITIONS`, it is better to also protect against empty target
property elements in the CMake generator expressions, which is
implemented in this commit.
This applies the change made to ROOT_GENERATE_DICTIONARY in the
main branch commit 08ab7e0 to GENREFLEX_GENERATE_DICTIONARY.

This commit in conjunction with 08ab7e0 fixes root-project#11312.

See commit 08ab7e0 and issue root-project#11312 for more details on the
issue and solution.
This corrects the content of 6efc168 [cmake] Protect against empty COMPILE_DEFINITIONS in genreflex command
@phsft-bot
Copy link

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac12/noimt, mac11/cxx14, windows10/cxx14
How to customize builds

@phsft-bot
Copy link

Build failed on mac12/noimt.
Running on macphsft18.dyndns.cern.ch:/Users/sftnight/build/jenkins/workspace/root-pullrequests-build
See console output.

Errors:

  • [2023-04-25T09:35:36.986Z] FAILED: VDT-prefix/src/VDT-stamp/VDT-configure /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/build/VDT-prefix/src/VDT-stamp/VDT-configure
  • [2023-04-25T09:35:36.986Z] CMake Error at /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/build/VDT-prefix/src/VDT-stamp/VDT-configure-Release.cmake:49 (message):

@phsft-bot
Copy link

Build failed on ROOT-performance-centos8-multicore/cxx17.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link

@guitargeek guitargeek merged commit 2e81322 into root-project:v6-24-00-patches Apr 25, 2023
@guitargeek guitargeek deleted the v6-24-00-patches_backports branch April 25, 2023 12:31
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.

3 participants