1111
1212include_guard ()
1313
14- configure_file (${CMAKE_CURRENT_LIST_DIR } /rootcling_wrapper.sh.in
15- ${CMAKE_BINARY_DIR } /rootcling_wrapper.sh @ONLY )
14+ set (O2_RUN_ROOTCLING_SCRIPT ${CMAKE_CURRENT_LIST_DIR } /RunRootcling.cmake)
1615
1716#
1817# add_root_dictionary generates one dictionary to be added to a target.
@@ -119,7 +118,9 @@ function(add_root_dictionary target)
119118 # get the list of compile_definitions
120119 set (prop $<TARGET_PROPERTY :${target} ,COMPILE_DEFINITIONS >)
121120
122- # Build the LD_LIBRARY_PATH required to get rootcling running fine
121+ # Build the LD_LIBRARY_PATH required to get rootcling running fine. It
122+ # REPLACES the inherited value, so RunRootcling.cmake applies it to rootcling
123+ # only: putting it on cmake itself hides cmake's own OpenSSL (see #12683).
123124 #
124125 # Need at least root core library
125126 get_filename_component (LD_LIBRARY_PATH ${ROOT_Core_LIBRARY} DIRECTORY )
@@ -132,25 +133,37 @@ function(add_root_dictionary target)
132133 set (includeDirs $<TARGET_PROPERTY :${target} ,INCLUDE_DIRECTORIES >)
133134 set (includeDirs $<REMOVE_DUPLICATES :${includeDirs} >)
134135
135- list (LENGTH A_EXTRA_PATCH hasExtraPatch)
136- # add a custom command to generate the dictionary using rootcling
136+ # the pcm dependencies (-m) are only meaningful where the modules are actually
137+ # loaded from disk, which is not the case on macOS
138+ set (pcmDeps $<REMOVE_DUPLICATES :$<TARGET_PROPERTY :${target} ,O2_PCM_DEPS >>)
139+ if (APPLE )
140+ set (pcmDeps)
141+ endif ()
142+
143+ if (A_EXTRA_PATCH)
144+ set (extraPatch -DPATCH=${CMAKE_CURRENT_LIST_DIR } /${A_EXTRA_PATCH} )
145+ else ()
146+ set (extraPatch)
147+ endif ()
148+
149+ # the arguments are joined with | so that they reach the script as a single
150+ # argument, see RunRootcling.cmake
137151 # cmake-format: off
152+ set (rootclingArgs
153+ -f|${dictionaryFile} |-inlineInputHeader|-noGlobalUsingStd|-rmf|${rootmapFile} |-rml|$<TARGET_FILE_NAME :${target} >|-I$<JOIN :${includeDirs} ,|-I >$<$<BOOL :${prop} >:|-D $<JOIN :${prop} ,|-D >>$<$<BOOL :${pcmDeps} >:|-m |$<JOIN :${pcmDeps} ,|-m |>>|$<JOIN :${headers} ,|>)
154+
155+ # add a custom command to generate the dictionary using rootcling
138156 add_custom_command (
139157 OUTPUT ${dictionaryFile} ${pcmFile} ${rootmapFile}
140158 VERBATIM
141159 COMMAND
142- ${CMAKE_BINARY_DIR } /rootcling_wrapper.sh
143- --rootmap_file ${rootmapFile}
144- --dictionary_file ${dictionaryFile}
145- --ld_library_path ${LD_LIBRARY_PATH}
146- --rootmap_library_name $<TARGET_FILE_NAME :${target} >
147- --include_dirs -I$<JOIN:${includeDirs},$<SEMICOLON>-I>
148- $<$<BOOL :${prop} >:--compile_defs >
149- $<$<BOOL :${prop} >:-D $<JOIN :${prop} ,$<SEMICOLON >-D >>
150- $<$<BOOL :${hasExtraPatch} >:--extra -patch >
151- $<$<BOOL :${hasExtraPatch} >:${CMAKE_CURRENT_LIST_DIR } /${A_EXTRA_PATCH} >
152- --pcmdeps "$<REMOVE_DUPLICATES :$<TARGET_PROPERTY :${target} ,O2_PCM_DEPS >>"
153- --headers "${headers} "
160+ ${CMAKE_COMMAND }
161+ -DROOTCLING=${ROOT_rootcling_CMD}
162+ -DDICTIONARY=${dictionaryFile}
163+ "-DLD_LIBRARY_PATH=${LD_LIBRARY_PATH} "
164+ ${extraPatch}
165+ "-DARGS=${rootclingArgs} "
166+ -P ${O2_RUN_ROOTCLING_SCRIPT}
154167 COMMAND
155168 ${CMAKE_COMMAND } -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR } /${pcmBase} ${pcmFile}
156169 DEPENDS ${headers} "$<REMOVE_DUPLICATES :$<TARGET_PROPERTY :${target} ,O2_PCM_DEPS >>" ${A_EXTRA_PATCH} )
0 commit comments