diff --git a/cmake/DD4hep.cmake b/cmake/DD4hep.cmake index 8232f8ffd81a8b553c0ae91a5ced15c9810b64ed..75f596355d05f5f8a353ebbb98e875ee75890dcc 100644 --- a/cmake/DD4hep.cmake +++ b/cmake/DD4hep.cmake @@ -73,6 +73,9 @@ endfunction() # dd4hep_generate_rootmap(library) # # Create the .components file needed by the plug-in system. +# +# Setting DD4HEP_GENERATE_ROOTMAP_EXTRA_ENV before calling allows callers to inject environment +# variables (such as LD_PRELOAD) into the listcomponents subprocess. #--------------------------------------------------------------------------------------------------- function(dd4hep_generate_rootmap library) @@ -102,10 +105,12 @@ function(dd4hep_generate_rootmap library) DEPENDS ${library} VERBATIM COMMAND "${CMAKE_COMMAND}" -E env + ${DD4HEP_GENERATE_ROOTMAP_EXTRA_ENV} "${ENV_VAR}=${_ld_path}" "ROOT_LIBRARY_PATH=${DD4HEP_ROOT_LIBRARY_PATH}" $ -o ${rootmapfile} $ WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} + COMMAND_EXPAND_LISTS ) add_custom_target(Components_${library} ALL DEPENDS ${rootmapfile})