-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[v624][cmake] Protect against empty COMPILE_DEFINITIONS in genreflex and rootcint commands #12712
Conversation
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
Starting build on |
Build failed on mac12/noimt. Errors:
|
Build failed on ROOT-performance-centos8-multicore/cxx17. Failing tests: |
Build failed on ROOT-ubuntu2004/python3. Failing tests:
|
Build failed on mac11/cxx14. Failing tests: |
Backport of these three PRs to ROOT 6.24:
COMPILE_DEFINITIONS
in rootcint command #11111Like this, I can build the ROOT 6.24 branch in my Arch Linux environment again to debug some RooFit stuff.