Skip to content
Snippets Groups Projects
Commit cd971d45 authored by Andre Sailer's avatar Andre Sailer Committed by Oksana Shadura
Browse files

[CMake] REFLEX_GENERATE_DICTIONARY: add USES parameter to pass targets from...

[CMake] REFLEX_GENERATE_DICTIONARY: add USES parameter to pass targets from which include directories and definitions can be obtained
parent 9ff6e8d1
No related branches found
No related tags found
No related merge requests found
......@@ -116,10 +116,17 @@ function(ROOT_GET_SOURCES variable cwd )
endfunction()
#---------------------------------------------------------------------------------------------------
#---REFLEX_GENERATE_DICTIONARY( dictionary headerfiles SELECTION selectionfile OPTIONS opt1 opt2 ...)
#---REFLEX_GENERATE_DICTIONARY( dictionary headerfiles SELECTION selectionfile OPTIONS opt1 opt2 ...
# DEPENDS dependency1 dependency2 ...
# USES target1 target2 ...
# )
#
# USES takes a list of targets. From the targets the properties INCLUDE_DIRECTORIES and
# COMPILE_DEFINITIONS are used to create the appropriate -I and -D flags
#
#---------------------------------------------------------------------------------------------------
macro(REFLEX_GENERATE_DICTIONARY dictionary)
CMAKE_PARSE_ARGUMENTS(ARG "" "SELECTION" "OPTIONS;DEPENDS" ${ARGN})
CMAKE_PARSE_ARGUMENTS(ARG "" "SELECTION" "OPTIONS;DEPENDS;USES" ${ARGN})
#---Get List of header files---------------
set(headerfiles)
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
......@@ -157,25 +164,36 @@ macro(REFLEX_GENERATE_DICTIONARY dictionary)
set(rootmapopts --rootmap=${rootmapname} --rootmap-lib=${libprefix}${dictionary}Dict)
endif()
set(include_dirs -I${CMAKE_CURRENT_SOURCE_DIR})
set(include_dirs ${CMAKE_CURRENT_SOURCE_DIR})
get_directory_property(incdirs INCLUDE_DIRECTORIES)
foreach(d ${incdirs})
if(NOT "${d}" MATCHES "^(AFTER|BEFORE|INTERFACE|PRIVATE|PUBLIC|SYSTEM)$")
set(include_dirs ${include_dirs} -I${d})
list(APPEND include_dirs ${d})
endif()
endforeach()
set(definitions)
get_directory_property(defs COMPILE_DEFINITIONS)
foreach( d ${defs})
set(definitions ${definitions} -D${d})
list(APPEND definitions ${d})
endforeach()
foreach(DEP ${ARG_USES})
LIST(APPEND include_dirs $<TARGET_PROPERTY:${DEP},INCLUDE_DIRECTORIES>)
LIST(APPEND definitions $<TARGET_PROPERTY:${DEP},COMPILE_DEFINITIONS>)
endforeach()
add_custom_command(
OUTPUT ${gensrcdict} ${rootmapname}
COMMAND ${ROOT_genreflex_CMD}
ARGS ${headerfiles} -o ${gensrcdict} ${rootmapopts} --select=${selectionfile}
--gccxmlpath=${GCCXML_home}/bin ${ARG_OPTIONS} ${include_dirs} ${definitions}
DEPENDS ${headerfiles} ${selectionfile} ${ARG_DEPENDS})
--gccxmlpath=${GCCXML_home}/bin ${ARG_OPTIONS}
"-I$<JOIN:${include_dirs},;-I>"
"$<$<BOOL:$<JOIN:${definitions},>>:-D$<JOIN:${definitions},;-D>>"
DEPENDS ${headerfiles} ${selectionfile} ${ARG_DEPENDS}
COMMAND_EXPAND_LISTS
)
#---roottest compability---------------------------------
if(CMAKE_ROOTTEST_DICT)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment