Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Merged
merged 4 commits into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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