@@ -222,6 +222,11 @@ if(builtin_llvm)
222222
223223 set (LLVM_ENABLE_PROJECTS "clang" CACHE STRING "" )
224224
225+ # Always build LLVM with C++17. It is not necessary to compile with the same
226+ # C++ standard as the rest of ROOT and sometimes it doesn't even work.
227+ set (_cxx_standard ${CMAKE_CXX_STANDARD} )
228+ set (CMAKE_CXX_STANDARD 17)
229+
225230 #---Reduce log level to suppress STATUS messages from LLVM
226231 if (NOT DEFINED CMAKE_MESSAGE_LOG_LEVEL)
227232 set (CMAKE_MESSAGE_LOG_LEVEL "NOTICE" )
@@ -239,6 +244,8 @@ if(builtin_llvm)
239244 unset (CMAKE_MESSAGE_LOG_LEVEL)
240245 endif ()
241246
247+ set (CMAKE_CXX_STANDARD ${_cxx_standard} )
248+
242249 set (LLVM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} /llvm-project/llvm/include
243250 ${CMAKE_CURRENT_BINARY_DIR} /llvm-project/llvm/include
244251 CACHE STRING "LLVM include directories."
@@ -453,7 +460,14 @@ else()
453460 # Disable linking against shared LLVM
454461 set (LLVM_LINK_LLVM_DYLIB OFF )
455462
463+ # Always build LLVM with C++17. It is not necessary to compile with the same
464+ # C++ standard as the rest of ROOT and sometimes it doesn't even work.
465+ set (_cxx_standard ${CMAKE_CXX_STANDARD} )
466+ set (CMAKE_CXX_STANDARD 17)
467+
456468 add_subdirectory (llvm-project/clang EXCLUDE_FROM_ALL )
469+
470+ set (CMAKE_CXX_STANDARD ${_cxx_standard} )
457471 endif (builtin_clang)
458472
459473 set ( CLANG_BUILT_STANDALONE 1 )
0 commit comments