Skip to content
Snippets Groups Projects
Commit 24165f99 authored by Andre Sailer's avatar Andre Sailer Committed by Marko Petric
Browse files

MakeGaudiMap: use target properties to get the necessary command and library locations

parent a13ebd0e
No related branches found
No related tags found
No related merge requests found
......@@ -86,17 +86,14 @@ function(dd4hep_generate_rootmap_notapple library)
if ( NOT DD4hep_DIR )
SET ( DD4hep_DIR ${CMAKE_SOURCE_DIR} )
endif()
find_package(ROOT QUIET)
set(rootmapfile ${CMAKE_SHARED_MODULE_PREFIX}${library}.components)
set(libname ${CMAKE_SHARED_MODULE_PREFIX}${library}${CMAKE_SHARED_LIBRARY_SUFFIX})
add_custom_command(OUTPUT ${rootmapfile}
DEPENDS ${library}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -Dlibname=${libname} -Drootmapfile=${rootmapfile}
-Dgenmap_install_dir=${LIBRARY_OUTPUT_PATH}
-DROOT_VERSION=${ROOT_VERSION}
COMMAND ${CMAKE_COMMAND} -Dlibname=$<TARGET_FILE_NAME:${library}> -Drootmapfile=${rootmapfile}
-DDD4HEP_LISTCOMPONENTS_CMD=$<TARGET_FILE:DD4hep::listcomponents>
-DLIBRARY_LOCATION=$<TARGET_FILE_DIR:${library}>
-DDD4hep_DIR=${DD4hep_DIR}
-P ${DD4hep_DIR}/cmake/MakeGaudiMap.cmake)
add_custom_target(Components_${library} ALL DEPENDS ${rootmapfile})
......@@ -104,8 +101,7 @@ function(dd4hep_generate_rootmap_notapple library)
if( CMAKE_INSTALL_LIBDIR )
SET( install_destination ${CMAKE_INSTALL_LIBDIR} )
endif()
install(FILES ${LIBRARY_OUTPUT_PATH}/${rootmapfile}
install(FILES $<TARGET_FILE_DIR:${library}>/${rootmapfile}
DESTINATION ${install_destination}
)
endfunction()
......
message(STATUS " *** Gaudi listcomponents: Generate map for ${libname} ..." )
#
# Running listcomponents from DD4hep
#
FIND_PROGRAM( Gaudi_listcomponents_CMD listcomponents PATHS ${genmap_install_dir}/../bin ${DD4hep_DIR}/bin
NO_DEFAULT_PATH NO_CMAKE_PATH)
GET_FILENAME_COMPONENT(GAUDI_LISTCOMP_INSTALL ${Gaudi_listcomponents_CMD} DIRECTORY)
###MESSAGE( STATUS " *** MakeRootMap ${genmap_install_dir}/../bin $ENV{DD4hep_DIR}/bin ${DD4hep_DIR}" )
MESSAGE( STATUS " *** MakeGaudiMap.cmake run command : ${Gaudi_listcomponents_CMD} -o ${rootmapfile} ${libname}
WORKING_DIRECTORY ${genmap_install_dir} "
#
MESSAGE( STATUS " *** MakeGaudiMap.cmake run command : ${DD4HEP_LISTCOMPONENTS_CMD} -o ${rootmapfile} ${libname}
WORKING_DIRECTORY ${LIBRARY_LOCATION} "
)
GET_FILENAME_COMPONENT(GAUDI_LISTCOMP_INSTALL ${DD4HEP_LISTCOMPONENTS_CMD} DIRECTORY)
if(APPLE)
SET ( ENV{DYLD_LIBRARY_PATH} ${genmap_install_dir}:$ENV{DYLD_LIBRARY_PATH}:$ENV{DD4HEP_LIBRARY_PATH} )
SET ( ENV{DYLD_LIBRARY_PATH} ${LIBRARY_LOCATION}:$ENV{DYLD_LIBRARY_PATH}:$ENV{DD4HEP_LIBRARY_PATH} )
##EXECUTE_PROCESS( COMMAND echo DYLD_LIBRARY_PATH = $ENV{DYLD_LIBRARY_PATH} )
else()
SET ( ENV{LD_LIBRARY_PATH} ${GAUDI_LISTCOMP_INSTALL}/../lib:${genmap_install_dir}:$ENV{LD_LIBRARY_PATH} )
SET ( ENV{LD_LIBRARY_PATH} ${LIBRARY_LOCATION}:${GAUDI_LISTCOMP_INSTALL}:$ENV{LD_LIBRARY_PATH} )
endif()
# EXECUTE_PROCESS( COMMAND echo LD_LIBRARY_PATH = $ENV{LD_LIBRARY_PATH} )
EXECUTE_PROCESS( COMMAND
${Gaudi_listcomponents_CMD} -o ${rootmapfile} ${libname}
WORKING_DIRECTORY ${genmap_install_dir}
${DD4HEP_LISTCOMPONENTS_CMD} -o ${rootmapfile} ${libname}
WORKING_DIRECTORY ${LIBRARY_LOCATION}
)
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