From b1e0f64fe5e4d5ceb85ae4a6cf29fd5102cf1c10 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Wed, 17 Jul 2019 11:45:25 +0200
Subject: [PATCH] Make root libs forward compatible when root uses ROOT::lib
 itself

---
 DDCore/CMakeLists.txt      | 2 +-
 DDEve/CMakeLists.txt       | 2 +-
 UtilityApps/CMakeLists.txt | 4 ++--
 cmake/DD4hepBuild.cmake    | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt
index 83280dcd8..5cf62168a 100644
--- a/DDCore/CMakeLists.txt
+++ b/DDCore/CMakeLists.txt
@@ -73,7 +73,7 @@ target_link_libraries(DDCore
   PUBLIC
   DD4hepGaudiPluginMgr
   DDParsers
-  ROOT::Core
+  ROOT::Core ROOT::Rint ROOT::Tree ROOT::Physics
   ROOT::Geom ROOT::GenVector
   ${XML_LIBRARIES} # XercesC or not
   )
diff --git a/DDEve/CMakeLists.txt b/DDEve/CMakeLists.txt
index d3d16e2bc..aaf446ed4 100644
--- a/DDEve/CMakeLists.txt
+++ b/DDEve/CMakeLists.txt
@@ -20,7 +20,7 @@ target_include_directories(DDEve_Interface
   $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
   $<INSTALL_INTERFACE:include>
 )
-target_link_libraries(DDEve_Interface INTERFACE ROOT::Core ROOT::Eve ROOT::Gui ROOT::Graf3d ROOT::RGL ROOT::EG)
+target_link_libraries(DDEve_Interface INTERFACE ROOT::Core ROOT::Rint ROOT::Eve ROOT::Gui ROOT::Graf3d ROOT::RGL ROOT::EG)
 
 new_dd4hep_add_dictionary(G__DDEve
   SOURCES ${DDCore_INCLUDE_DIRS}/include/ROOT/Warnings.h include/DDEve/*.h
diff --git a/UtilityApps/CMakeLists.txt b/UtilityApps/CMakeLists.txt
index d6e894795..b38f7da07 100644
--- a/UtilityApps/CMakeLists.txt
+++ b/UtilityApps/CMakeLists.txt
@@ -32,10 +32,10 @@ add_executable(materialScan src/materialScan.cpp)
 target_link_libraries(materialScan ROOT::Core ROOT::Geom DDRec)
 #-----------------------------------------------------------------------------------
 add_executable(materialBudget  src/materialBudget.cpp)
-target_link_libraries(materialBudget ROOT::Core ROOT::Geom DDRec)
+target_link_libraries(materialBudget ROOT::Core ROOT::Geom DDRec ROOT::Hist)
 #-----------------------------------------------------------------------------------
 add_executable(graphicalScan src/graphicalScan.cpp)
-target_link_libraries(graphicalScan ROOT::Core ROOT::Geom DDRec)
+target_link_libraries(graphicalScan ROOT::Core ROOT::Geom DDRec ROOT::Hist)
 #-----------------------------------------------------------------------------------
 
 
diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake
index 2df8a8555..25458f2dc 100644
--- a/cmake/DD4hepBuild.cmake
+++ b/cmake/DD4hepBuild.cmake
@@ -1655,7 +1655,7 @@ macro(DD4HEP_SETUP_ROOT_TARGETS)
       INTERFACE_INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIRS}
       )
     # there is also no dependency between the targets
-    TARGET_LINK_LIBRARIES(ROOT::Core INTERFACE Core Rint Tree MathCore Hist Physics)
+    TARGET_LINK_LIBRARIES(ROOT::Core INTERFACE Core)
     #foreach(LIB Core RIO Net Hist Graf Graf3d Gpad Tree Rint Postscript Matrix Physics MathCore Thread MultiProc)
     # MESSAGE(STATUS "ROOT lib location ${LIB} ${ROOT_${LIB}_LIBRARY}")
     # SET_TARGET_PROPERTIES(ROOT::${LIB}
@@ -1666,7 +1666,7 @@ macro(DD4HEP_SETUP_ROOT_TARGETS)
     #   )
     #endforeach()
     # Non-standard ROOT components we need later on, we "import" them by hand for now
-    foreach(LIB PyROOT Geom GenVector Eve Graf3d RGL Gui RIO MathCore MathMore EG EGL)
+    foreach(LIB PyROOT Geom GenVector Eve Graf3d RGL Gui RIO MathCore MathMore EG EGL Rint Tree Hist Physics)
       ADD_LIBRARY(ROOT::${LIB} INTERFACE IMPORTED GLOBAL)
       TARGET_LINK_LIBRARIES(ROOT::${LIB} INTERFACE ${LIB})
       # SET_TARGET_PROPERTIES(ROOT::${LIB}
-- 
GitLab