From d74a04c65cc456ec6f4f43de2e1017edd22d2b79 Mon Sep 17 00:00:00 2001
From: scott snyder <snyder@bnl.gov>
Date: Tue, 10 Nov 2020 17:46:02 +0100
Subject: [PATCH] RootUtils: cmake fix for clang compilation

Only the RootUtilsPyROOT library should depend on the pyroot libraries
(ROOTTPython and cppyy).  In particular, the RootUtils library should not
depend on these libraries.

Things were failing in the clang build because RootUtils was linking
against cppyy but _not_ against python, so things downstream were failing
to find python symbols.

(In principle this is wrong for the gcc build as well; not entirely
sure why it was working there.)
---
 Control/RootUtils/CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Control/RootUtils/CMakeLists.txt b/Control/RootUtils/CMakeLists.txt
index 0bb8ca72952e..a3e11e0870e7 100644
--- a/Control/RootUtils/CMakeLists.txt
+++ b/Control/RootUtils/CMakeLists.txt
@@ -9,6 +9,9 @@ find_package( Python COMPONENTS Development )
 find_package( ROOT COMPONENTS RIO Hist Tree Core MathCore ROOTTPython
    cppyy${Python_VERSION_MAJOR}_${Python_VERSION_MINOR} )
 
+set( ROOT_LIBRARIES_PYROOT ${ROOT_LIBRARIES} )
+find_package( ROOT COMPONENTS RIO Hist Tree Core MathCore )
+
 # Component(s) in the package:
 atlas_generate_reflex_dictionary( dict_cpp RootUtils
    HEADER ${CMAKE_CURRENT_SOURCE_DIR}/RootUtils/RootUtilsDict.h
@@ -28,7 +31,7 @@ atlas_add_library( RootUtilsPyROOT
    PUBLIC_HEADERS RootUtils
    INCLUDE_DIRS ${Python_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
    ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${Python_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES}
+   LINK_LIBRARIES ${Python_LIBRARIES} ${Boost_LIBRARIES} ${ROOT_LIBRARIES_PYROOT}
    CxxUtils )
 
 atlas_add_dictionary( RootUtilsPyROOTDict
-- 
GitLab