From 498bc4df84d99068bd7dc1d06c454a8b6f360e92 Mon Sep 17 00:00:00 2001
From: Tobias Triffterer <tobias@ep1.ruhr-uni-bochum.de>
Date: Wed, 28 Apr 2021 22:38:25 +0200
Subject: [PATCH] Add Version Switch for ROOT
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The interface of RooDataHist was improved in ROOT 6.24 and the old way of
querying the content of a bin was deprecated.

Therefore, a macro is added to compile code using the new interface on a
ROOT version ≥ 6.24 and do it the old way otherwise.
---
 CMakeLists.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 62935bd..e972c6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,3 +98,9 @@ target_link_libraries(fp311online PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets ROOT::H
 set_property(TARGET fp311online PROPERTY POSITION_INDEPENDENT_CODE ON)
 set_property(TARGET fp311online PROPERTY CXX_VISIBILITY_PRESET hidden)
 set_property(TARGET fp311online PROPERTY VISIBILITY_INLINES_HIDDEN ON)
+
+if (${ROOT_VERSION} VERSION_GREATER_EQUAL 6.24)
+  # The interface of RooDataHist was improved in ROOT 6.24 and the old way of
+  # querying the content of a bin was deprecated.
+  target_compile_definitions(fp311online PUBLIC ROOT_6_24_OR_NEWER)
+endif (${ROOT_VERSION} VERSION_GREATER_EQUAL 6.24)
-- 
GitLab