From cbfb3873b9346afc8736481b2903df8c89b84c57 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Fri, 23 Aug 2019 16:49:54 +0200
Subject: [PATCH] CMake: special treatment for imported targets from root 6.12

---
 cmake/DD4hepBuild.cmake | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake
index 045cdaaaa..7863f6c26 100644
--- a/cmake/DD4hepBuild.cmake
+++ b/cmake/DD4hepBuild.cmake
@@ -651,7 +651,15 @@ macro(DD4HEP_SETUP_ROOT_TARGETS)
         TARGET_LINK_LIBRARIES(ROOT::${LIB} INTERFACE ${LIB} ROOT::Core)
       ENDIF()
     endforeach()
-  ENDIF(NOT TARGET ROOT::Core)
+  ELSEIF(${ROOT_VERSION} VERSION_GREATER_EQUAL 6.12 AND ${ROOT_VERSION} VERSION_LESS 6.14)
+    # Root 6.12 exports ROOT::Core, but does not assign include directories to the target
+    SET_TARGET_PROPERTIES(ROOT::Core
+      PROPERTIES
+      INTERFACE_COMPILE_OPTIONS "${DD4HEP_ROOT_CXX_FLAGS}"
+      INTERFACE_INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIRS}
+      )
+
+  ENDIF()
 
   dd4hep_debug("ROOT Libraries ${ROOT_LIBRARIES}")
   dd4hep_debug("ROOT CXX_FLAGS ${DD4HEP_ROOT_CXX_FLAGS}")
-- 
GitLab