Skip to content

Commit 11897d0

Browse files
jmcarcellguitargeek
authored andcommitted
[CMake] Set ROOT_genreflex_CMD in a more robust way
Make sure it can be set in downstream projects. `genreflex` as a target doesn't exist, but `ROOT::genreflex` does.
1 parent 77cf282 commit 11897d0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

cmake/modules/RootMacros.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,13 @@ function(REFLEX_GENERATE_DICTIONARY dictionary)
198198
LIST(APPEND definitions "$<FILTER:$<TARGET_PROPERTY:${dictionary},COMPILE_DEFINITIONS>,EXCLUDE,^$>")
199199
ENDIF()
200200

201-
set(ROOT_genreflex_CMD $<TARGET_FILE:genreflex>)
201+
if(CMAKE_PROJECT_NAME STREQUAL ROOT)
202+
set(ROOT_genreflex_CMD $<TARGET_FILE:genreflex>)
203+
elseif(TARGET ROOT::genreflex)
204+
set(ROOT_genreflex_CMD $<TARGET_FILE:ROOT::genreflex>)
205+
else()
206+
set(ROOT_genreflex_CMD ${ROOT_BINDIR}/genreflex)
207+
endif()
202208
add_custom_command(
203209
COMMAND ${ROOT_genreflex_CMD}
204210
ARGS ${headerfiles} -o ${gensrcdict} ${rootmapopts} --select=${selectionfile}

0 commit comments

Comments
 (0)