Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions cmake/modules/RootMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -621,21 +621,24 @@ function(ROOT_GENERATE_DICTIONARY dictionary)
endif()

#---Get the library and module dependencies-----------------
if(ARG_DEPENDENCIES)
foreach(dep ${ARG_DEPENDENCIES})
# Whether <dep> provides a dictionary/pcm is decided at generation time
# via $<TARGET_EXISTS:G__<dep>>, so the '-m' flag and the module-file
# dependency below are independent of configuration order and expand to
# nothing for a dictionary-less library.
set(dep_has_dict "$<TARGET_EXISTS:G__${dep}>")
set(dependent_pcm ${libprefix}${dep}_rdict.pcm)
if (runtime_cxxmodules AND NOT dep IN_LIST local_no_cxxmodules)
set(dependent_pcm ${dep}.pcm)
list(APPEND pcm_dependencies "$<${dep_has_dict}:$<TARGET_PROPERTY:${dep},ROOT_PCM_FILENAME>>")
endif()
set(newargs ${newargs} "$<${dep_has_dict}:-m>" "$<${dep_has_dict}:${dependent_pcm}>")
endforeach()
endif()
# Every dictionary implicitly depends on Core's pcm, except the one for Core itself.
if(ARG_MODULE AND NOT ARG_MODULE STREQUAL "Core")
list(INSERT ARG_DEPENDENCIES 0 Core)
list(REMOVE_DUPLICATES ARG_DEPENDENCIES)
endif()
foreach(dep ${ARG_DEPENDENCIES})
# Whether <dep> provides a dictionary/pcm is decided at generation time
Comment on lines +625 to +630

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I liked your first attempt to put Core in the for loop:

Suggested change
if(ARG_MODULE AND NOT ARG_MODULE STREQUAL "Core")
list(INSERT ARG_DEPENDENCIES 0 Core)
list(REMOVE_DUPLICATES ARG_DEPENDENCIES)
endif()
foreach(dep ${ARG_DEPENDENCIES})
# Whether <dep> provides a dictionary/pcm is decided at generation time
foreach(dep Core ${ARG_DEPENDENCIES})
if(dep STREQUAL ARG_MODULE)
continue() # Don't depend on self
endif()
# Whether <dep> provides a dictionary/pcm is decided at generation time

I think this should work because ${dep} will be compared to "ARG_MODULE" if the latter is not a variable.

@ferdymercury ferdymercury Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The drawback of this is that there might be already Core in ARG_DEPENDENCIES so we would pass twice for it in the loop

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I liked your first attempt to put Core in the for loop:

Then it gets added for Core it self and that can not work.

# via $<TARGET_EXISTS:G__<dep>>, so the '-m' flag and the module-file
# dependency below are independent of configuration order and expand to
# nothing for a dictionary-less library.
set(dep_has_dict "$<TARGET_EXISTS:G__${dep}>")
set(dependent_pcm ${libprefix}${dep}_rdict.pcm)
if (runtime_cxxmodules AND NOT dep IN_LIST local_no_cxxmodules)
set(dependent_pcm ${dep}.pcm)
list(APPEND pcm_dependencies "$<${dep_has_dict}:$<TARGET_PROPERTY:${dep},ROOT_PCM_FILENAME>>")
endif()
set(newargs ${newargs} "$<${dep_has_dict}:-m>" "$<${dep_has_dict}:${dependent_pcm}>")
endforeach()

if(cpp_module_file)
set(newargs -cxxmodule ${newargs})
Expand Down
Loading