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: 31 additions & 2 deletions cmake/MacroRootDict.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ ENDMACRO( PREPARE_ROOT_DICT_HEADERS )



# Convert an absolute dictionary input header to the path used to include it.
MACRO( ROOT_DICT_HEADER_INCLUDE_PATH _header _output )

SET( ${_output} "${_header}" )

IF( IS_ABSOLUTE "${_header}" )
FOREACH( _include_dir ${ROOT_DICT_INCLUDE_DIRS} )
IF( IS_ABSOLUTE "${_include_dir}" )
FILE( RELATIVE_PATH _relative_header "${_include_dir}" "${_header}" )
IF( NOT _relative_header MATCHES "^\\.\\." )
SET( ${_output} "${_relative_header}" )
BREAK()
ENDIF()
ENDIF()
ENDFOREACH()
ENDIF()

ENDMACRO( ROOT_DICT_HEADER_INCLUDE_PATH )



# ============================================================================
# helper macro to generate Linkdef.h files for rootcint
#
Expand Down Expand Up @@ -108,13 +129,22 @@ MACRO( GEN_ROOT_DICT_SOURCE _dict_src_filename )
#SET( _dict_includes ${_dict_includes} -I${_inc} )
ENDFOREACH()

# Use relative paths when invoking rootcint. Keep
# ROOT_DICT_INPUT_HEADERS unchanged below because CMake dependencies must
# refer to the original files.
SET( _dict_headers )
FOREACH( _header ${ROOT_DICT_INPUT_HEADERS} )
ROOT_DICT_HEADER_INCLUDE_PATH( "${_header}" _dict_header )
LIST( APPEND _dict_headers "${_dict_header}" )
ENDFOREACH()

STRING( REPLACE "/" "_" _dict_src_filename_nosc ${_dict_src_filename} )
SET( _dict_src_file ${ROOT_DICT_OUTPUT_DIR}/${_dict_src_filename_nosc} )
STRING( REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" _dict_hdr_file "${_dict_src_file}" )
ADD_CUSTOM_COMMAND(
OUTPUT ${_dict_src_file} ${_dict_hdr_file}
COMMAND mkdir -p ${ROOT_DICT_OUTPUT_DIR}
COMMAND ${ROOT_rootcint_CMD} -f "${_dict_src_file}" -c ${ROOT_DICT_CINT_DEFINITIONS} ${_dict_includes} ${ROOT_DICT_INPUT_HEADERS}
COMMAND ${ROOT_rootcint_CMD} -f "${_dict_src_file}" -c ${ROOT_DICT_CINT_DEFINITIONS} ${_dict_includes} ${_dict_headers}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS ${ROOT_DICT_INPUT_HEADERS}
COMMENT "generating: ${_dict_src_file} ${_dict_hdr_file}"
Expand All @@ -123,4 +153,3 @@ MACRO( GEN_ROOT_DICT_SOURCE _dict_src_filename )

ENDMACRO()
# ============================================================================

Loading