Skip to content

Commit 6c9e36c

Browse files
illuhaddevajithvs
authored andcommitted
[cmake] Refuse too new or development LLVM versions by default
1 parent b43943a commit 6c9e36c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ else()
9292
endif()
9393
endif()
9494

95+
set(ACPP_EXPERIMENTAL_LLVM OFF CACHE BOOL "Whether to allow building AdaptiveCpp against unsupported LLVM versions")
96+
9597
set(HIPSYCL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
9698
set(ACPP_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
9799
set(ACPP_BINARY_ROOT "${CMAKE_CURRENT_BINARY_DIR}")
@@ -400,6 +402,18 @@ if(BUILD_CLANG_PLUGIN)
400402
set(WITH_ACCELERATED_CPU false)
401403
endif()
402404
endif()
405+
if(NOT ACPP_EXPERIMENTAL_LLVM)
406+
if(${LLVM_VERSION_MAJOR} GREATER 20)
407+
message(SEND_ERROR "LLVM versions greater than 20 are not yet tested/supported, use -DACPP_EXPERIMENTAL_LLVM=ON if you still wish to try your luck.")
408+
endif()
409+
if(${LLVM_VERSION_MAJOR} GREATER 17)
410+
# Starting from LLVM 18, releases will have LLVM_VERSION_MINOR>0
411+
if(${LLVM_VERSION_MINOR} EQUAL 0)
412+
message(SEND_ERROR "This LLVM seems to be a development version; only LLVM releases are tested and supported. Use -DACPP_EXPERIMENTAL_LLVM=ON if you still wish to try your luck.")
413+
endif()
414+
endif()
415+
endif()
416+
403417
message(STATUS "Using clang include directory: ${CLANG_INCLUDE_PATH}")
404418

405419
# Check if building on Windows and LLVM_LIBS is set, if not, use LLVM_AVAILABLE_LIBS

0 commit comments

Comments
 (0)