diff --git a/deps/LLVMExtra/CMakeLists.txt b/deps/LLVMExtra/CMakeLists.txt index 9abcd992..1b9d0198 100644 --- a/deps/LLVMExtra/CMakeLists.txt +++ b/deps/LLVMExtra/CMakeLists.txt @@ -13,7 +13,11 @@ LANGUAGES C ) -set(CMAKE_CXX_STANDARD 17) +if(NOT DEFINED CXX_STANDARD) + set(CXX_STANDARD 17) +endif() +set(CMAKE_CXX_STANDARD ${CXX_STANDARD}) + set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/deps/build_local.jl b/deps/build_local.jl index 032d3619..ca993b94 100644 --- a/deps/build_local.jl +++ b/deps/build_local.jl @@ -45,10 +45,17 @@ else end LLVM_DIR = joinpath(LLVM.artifact_dir, "lib", "cmake", "llvm") +# LLVM 16 requires C++17 +cxx_standard = if Base.libllvm_version >= v"16" + "17" +else + "14" +end + # build and install @info "Building" source_dir scratch_dir build_dir LLVM_DIR cmake() do cmake_path - config_opts = `-DLLVM_ROOT=$(LLVM_DIR) -DCMAKE_INSTALL_PREFIX=$(scratch_dir)` + config_opts = `-DLLVM_ROOT=$(LLVM_DIR) -DCXX_STANDARD=$(cxx_standard) -DCMAKE_INSTALL_PREFIX=$(scratch_dir)` if Sys.iswindows() # prevent picking up MSVC config_opts = `$config_opts -G "MSYS Makefiles"`