Skip to content

Commit

Permalink
Detect more c++ standards and make sure useful message actually appea…
Browse files Browse the repository at this point in the history
…rs (#635)

* Detect more c++ standards and make sure useful message actually appears

* Order c++ standards numerically

* Use a for loop to detect ROOT c++ standard

* Add a bit more logging
  • Loading branch information
tmadlener committed Jul 8, 2024
1 parent c30b218 commit 1fc075d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,20 @@ endif()
# ROOT_CXX_STANDARD was introduced in https://github.com/root-project/root/pull/6466
# before that it's an empty variable so we check if it's any number > 0
if(NOT DEFINED ROOT_CXX_STANDARD)
message(STATUS "ROOT c++ standard not yet available. Determining from compile features")
get_target_property(ROOT_COMPILE_FEATURES ROOT::Core INTERFACE_COMPILE_FEATURES)
if("cxx_std_17" IN_LIST ROOT_COMPILE_FEATURES)
set(ROOT_CXX_STANDARD 17)
elseif("cxx_std_20" IN_LIST ROOT_COMPILE_FEATURES)
set(ROOT_CXX_STANDARD 20)
else()
message(FATAL_ERROR "ROOT C++ could not be detected")
endif()
foreach(cxxstd IN ITEMS 20;17;14;11)
if ("cxx_std_${cxxstd}" IN_LIST ROOT_COMPILE_FEATURES)
set(ROOT_CXX_STANDARD ${cxxstd})
break()
endif()
endforeach()
endif()

if(NOT DEFINED ROOT_CXX_STANDARD)
message(WARNING "ROOT c++ standard could not be detected")
else()
message(STATUS "Determined ROOT c++ standard: " ${ROOT_CXX_STANDARD})
endif()

if(ROOT_CXX_STANDARD VERSION_LESS 17)
Expand Down

0 comments on commit 1fc075d

Please sign in to comment.