Skip to content
Snippets Groups Projects

Use C++20 when building with gcc>=13 or clang>=16

Merged Marco Clemencic requested to merge fix-cxxstd-version into master
1 file
+ 8
2
Compare changes
  • Side-by-side
  • Inline
###############################################################################
# (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration #
# (c) Copyright 2021-2024 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
@@ -19,7 +19,13 @@ find_data_package(Geant4Files ${Geant4_VERSION_MAJOR}${Geant4_VERSION_MINOR}.0)
# FIXME: this should match the version used by ROOT (LCG version + compiler version)
set(GEANT4_BUILD_CXXSTD 17 CACHE STRING "C++ Standard")
if( (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13.0")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "16.0") )
set(LHCB_DEFAULT_CXXSTD 17)
else()
set(LHCB_DEFAULT_CXXSTD 20)
endif()
set(GEANT4_BUILD_CXXSTD ${LHCB_DEFAULT_CXXSTD} CACHE STRING "C++ Standard")
set(OpenGL_GL_PREFERENCE "GLVND" CACHE STRING
"Preferred GL library to use (see https://cmake.org/cmake/help/v3.12/policy/CMP0072.html)")
Loading