From b2cedb4cec00bcb999e5a98b2302c501d1d0c9f7 Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Tue, 11 Oct 2022 17:33:47 +0200
Subject: [PATCH] Fix problem with missing ROOTSYS variable

If using a non FairSoft installation of the dependencies problems were
reported after the last changes to the build system. Instead of hardcoding
the SIMPATH use the the information from ROOT about its binary directory.
Remove some old usage of the root-config script, use CMake variables provided
by ROOT instead.
---
 CMakeLists.txt      | 5 +++--
 core/CMakeLists.txt | 9 ++-------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e383aca03..198634c6c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,8 +71,9 @@ list(PREPEND CMAKE_PREFIX_PATH ${SIMPATH})
 find_package(ROOT 6.22 CONFIG REQUIRED)
 if(ROOT_FOUND)
   Message("Root was found")
-  set(ROOT_CINT_EXECUTABLE ${SIMPATH}/bin/rootcling)
-  set(ROOT_CONFIG_EXECUTABLE ${SIMPATH}/bin/root-config)
+  # The following CMake variables are needed until the modernization is done 
+  set(ROOT_CINT_EXECUTABLE ${ROOT_BINDIR}/rootcling)
+  set(ROOT_CONFIG_EXECUTABLE ${ROOT_BINDIR}/root-config)
   set(ROOT_INCLUDE_DIR ${ROOT_INCLUDE_DIRS})
 endif()
 
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index 0147239fcc..ab46e91eb5 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -14,13 +14,8 @@ add_subdirectory(detectors/tof)
 add_subdirectory(detectors/sts)
 add_subdirectory(detectors/psd)
 
-Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --has-opengl
-                OUTPUT_VARIABLE EveIsBuild
-                OUTPUT_STRIP_TRAILING_WHITESPACE
-               )
-
-If(${EveIsBuild} STREQUAL yes)
-  Message(STATUS "Build the eventdisplay.")
+If(ROOT_opengl_FOUND)
+  Message(STATUS "OpenGL support found. Build the eventdisplay.")
   add_subdirectory (eventdisplay)
 Else()
   Message(STATUS "The eventdisplay is not build, there is no OpenGL support.")
-- 
GitLab