From a0b700a648fb4e304786def528aa233a24c06c70 Mon Sep 17 00:00:00 2001 From: Andre Sailer <andre.philippe.sailer@cern.ch> Date: Wed, 17 Jul 2019 11:21:04 +0200 Subject: [PATCH] Fixes to work with USE_LCIO=ON --- DDEve/CMakeLists.txt | 9 +++++---- DDG4/CMakeLists.txt | 23 +++++++++++++++-------- DDTest/CMakeLists.txt | 9 +++++---- cmake/DD4hepBuild.cmake | 10 ++++++---- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/DDEve/CMakeLists.txt b/DDEve/CMakeLists.txt index d1f6abfb3..ce3621251 100644 --- a/DDEve/CMakeLists.txt +++ b/DDEve/CMakeLists.txt @@ -31,14 +31,15 @@ new_dd4hep_add_dictionary(G__DDEve DEPENDS DDCore ) -if(LCIO_FOUND) +if(TARGET LCIO::LCIO) SET(DDEVE_LCIO_SOURCES lcio/LCIOEventHandler.cpp) + SET(DDEVE_LCIO_LINK LCIO::LCIO) endif() -new_dd4hep_add_plugin (DDEvePlugins SOURCES src/*.cpp - GENERATED ${DDEVE_LCIO_SOURCES} G__DDEve.cxx +new_dd4hep_add_plugin (DDEvePlugins SOURCES src/*.cpp ${DDEVE_LCIO_SOURCES} + GENERATED G__DDEve.cxx + LINK_LIBRARIES DDCore DDEve_Interface ROOT::Eve ${DDEVE_LCIO_LINK} ) -target_link_libraries(DDEvePlugins DDCore DDEve_Interface ROOT::Eve) if(DD4HEP_USE_GEANT4) new_dd4hep_add_dictionary(G__DDG4IO diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt index 47a683c9c..6963d331a 100644 --- a/DDG4/CMakeLists.txt +++ b/DDG4/CMakeLists.txt @@ -100,16 +100,19 @@ endif() IF(DD4HEP_USE_LCIO) new_dd4hep_add_plugin(DDG4LCIO SOURCES lcio/*.cpp - LINK_LIBRARIES LCIO::LCIO + LINK_LIBRARIES DDG4 LCIO::LCIO ) + install(TARGETS DDG4LCIO LIBRARY DESTINATION lib) ENDIF() # #--------------------------- DDRec dependent Plugins ----------------------------- -IF(DDRec) - new_dd4hep_add_plugin(DDG4Reco - SOURCES reco/*.cpp - LINK_LIBRARIES DDRec - ) -ENDIF() +#This does not compile at the moment +# IF(TARGET DDRec) +# new_dd4hep_add_plugin(DDG4Reco +# SOURCES reco/*.cpp +# LINK_LIBRARIES DDCore DDG4 DDRec +# ) +# install(TARGETS DDG4Reco LIBRARY DESTINATION lib) +# ENDIF() #----------------------------------------------------------------------------------- add_executable(g4gdmlDisplay g4gdmlDisplay.cpp) #----------------------------------------------------------------------------------- @@ -126,6 +129,10 @@ dd4hep_install_dir(python/DDSim DESTINATION python) INSTALL(TARGETS DDG4 EXPORT DD4hep DESTINATION lib) INSTALL(TARGETS DDG4 DDG4Plugins - LIBRARY DESTINATION lib) + g4gdmlDisplay + g4FromXML + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) INSTALL(DIRECTORY include/DDG4 DESTINATION include) diff --git a/DDTest/CMakeLists.txt b/DDTest/CMakeLists.txt index 479e24fcd..4adb2e880 100644 --- a/DDTest/CMakeLists.txt +++ b/DDTest/CMakeLists.txt @@ -9,6 +9,9 @@ # #================================================================================= +add_library(DDTest INTERFACE) +target_include_directories(DDTest INTERFACE include) + foreach(TEST_NAME test_example test_bitfield64 @@ -20,8 +23,7 @@ foreach(TEST_NAME test_segmentationHandles ) add_executable(${TEST_NAME} src/${TEST_NAME}.cc) - target_link_libraries(${TEST_NAME} DDCore DDRec) - target_include_directories(${TEST_NAME} PRIVATE ./include) + target_link_libraries(${TEST_NAME} DDCore DDRec DDTest) install(TARGETS ${TEST_NAME} DESTINATION bin) set(cmd ${CMAKE_INSTALL_PREFIX}/bin/run_test.sh ${TEST_NAME}) @@ -34,8 +36,7 @@ foreach(TEST_NAME test_surface ) add_executable(${TEST_NAME} src/${TEST_NAME}.cc) - target_link_libraries(${TEST_NAME} DDCore DDRec) - target_include_directories(${TEST_NAME} PRIVATE ./include) + target_link_libraries(${TEST_NAME} DDCore DDRec DDTest) install(TARGETS ${TEST_NAME} DESTINATION bin) add_test(NAME t_${TEST_NAME} COMMAND ${CMAKE_INSTALL_PREFIX}/bin/run_test.sh ${TEST_NAME} file:${CMAKE_CURRENT_SOURCE_DIR}/units.xml) diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake index e4a1c2a6d..9b43f8efc 100644 --- a/cmake/DD4hepBuild.cmake +++ b/cmake/DD4hepBuild.cmake @@ -1765,10 +1765,12 @@ MACRO(DD4HEP_SETUP_GEANT4_TARGETS) ENDMACRO() MACRO(DD4HEP_SETUP_LCIO_TARGETS) - IF(NOT TARGET LCIO::LCIO) - ADD_LIBRARY(LCIO::LCIO INTERFACE GLOBAL) - TARGET_LINK_LIBRARIES(LCIO::LCIO ${LCIO_LIBRARIES}) - TARGET_INLCUDE_DIRECTORIES(LCIO::LCIO INTERFACE ${LCIO_INCLUDE_DIRS}) + ADD_LIBRARY(LCIO::LCIO INTERFACE IMPORTED GLOBAL) + SET_TARGET_PROPERTIES(LCIO::LCIO + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LCIO_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${LCIO_LIBRARIES}" + ) ENDIF() ENDMACRO() -- GitLab