From 05dc0f9bf54de45296ea8dd39446e4599ce5044b Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 17 Jan 2024 11:45:37 +0100 Subject: [PATCH] Add a check using ROOT_CXX_STANDARD --- CMakeLists.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0515b96c..afcca6c77 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,10 +86,18 @@ else() endif() # Check that root is compiled with a modern enough c++ standard -get_target_property(ROOT_COMPILE_FEATURES ROOT::Core INTERFACE_COMPILE_FEATURES) -if (NOT "cxx_std_17" IN_LIST ROOT_COMPILE_FEATURES AND NOT "cxx_std_20" IN_LIST ROOT_COMPILE_FEATURES) - message(FATAL_ERROR "You are trying to build podio against a version of ROOT that has not been built with a sufficient c++ standard. podio requires c++17 or higher") +if(ROOT_CXX_STANDARD VERSION_GREATER 0) + # ROOT_CXX_STANDARD was introduced in https://github.com/root-project/root/pull/6466 + if(ROOT_CXX_STANDARD VERSION_LESS 17) + message(FATAL_ERROR "You are trying to build podio against a version of ROOT that has not been built with a sufficient c++ standard. podio requires c++17 or higher") + endif() +else() + get_target_property(ROOT_COMPILE_FEATURES ROOT::Core INTERFACE_COMPILE_FEATURES) + if (NOT "cxx_std_17" IN_LIST ROOT_COMPILE_FEATURES AND NOT "cxx_std_20" IN_LIST ROOT_COMPILE_FEATURES) + message(FATAL_ERROR "You are trying to build podio against a version of ROOT that has not been built with a sufficient c++ standard. podio requires c++17 or higher") + endif() endif() + #Check if Python version detected matches the version used to build ROOT SET(Python_FIND_FRAMEWORK LAST) IF((TARGET ROOT::PyROOT OR TARGET ROOT::ROOTTPython) AND ${ROOT_VERSION} VERSION_GREATER_EQUAL 6.19)