diff --git a/cmake/modules/RootMacros.cmake b/cmake/modules/RootMacros.cmake index 478c73627ae31..d3919aa27dd81 100644 --- a/cmake/modules/RootMacros.cmake +++ b/cmake/modules/RootMacros.cmake @@ -631,8 +631,14 @@ function(ROOT_GENERATE_DICTIONARY dictionary) #---Get the library and module dependencies----------------- # Every dictionary implicitly depends on Core's pcm, except the one for Core itself. + # Only when building ROOT itself: downstream projects have no plain 'Core' target + # (only ROOT::Core), and a bare 'Core' in DEPENDS would be treated as a file. if(ARG_MODULE AND NOT ARG_MODULE STREQUAL "Core") - list(INSERT ARG_DEPENDENCIES 0 Core) + if(TARGET ROOT::Core) + list(INSERT ARG_DEPENDENCIES 0 ROOT::Core) + elseif(TARGET Core) + list(INSERT ARG_DEPENDENCIES 0 Core) + endif() list(REMOVE_DUPLICATES ARG_DEPENDENCIES) endif() foreach(dep ${ARG_DEPENDENCIES})