File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -302,7 +302,10 @@ target_link_libraries(python-cpp
302302)
303303
304304# LLVM backend
305- find_package (LLVM CONFIG 23 )
305+ # No version is requested here for the same reason as in executable/mlir: LLVM's
306+ # config-version file wants an exact major.minor match. The MLIR subdirectory has
307+ # already validated the major version by this point.
308+ find_package (LLVM CONFIG )
306309if (ENABLE_LLVM_BACKEND AND NOT LLVM_FOUND)
307310 message (FATAL_ERROR "Could not find LLVM in the local environment" )
308311elseif (ENABLE_LLVM_BACKEND AND LLVM_FOUND)
Original file line number Diff line number Diff line change 1- find_package (LLVM 23 REQUIRED CONFIG )
2- message (STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR} " )
1+ # LLVMConfigVersion.cmake only accepts an exact major.minor match, so asking for
2+ # "23" means "23.0" and rejects the 23.1.x releases. Search without a version,
3+ # newest install first, and enforce the major version ourselves.
4+ set (CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
5+ set (CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
6+ find_package (LLVM REQUIRED CONFIG )
7+ if (LLVM_VERSION_MAJOR LESS 23)
8+ message (FATAL_ERROR
9+ "LLVM 23 or newer is required, found ${LLVM_PACKAGE_VERSION} in ${LLVM_DIR} . "
10+ "Point CMake at a newer install with -DLLVM_DIR=<prefix>/lib/cmake/llvm" )
11+ endif ()
12+ message (STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR} (${LLVM_PACKAGE_VERSION} )" )
313
414find_package (MLIR CONFIG REQUIRED
515 HINTS ${LLVM_DIR} /../lib/cmake/mlir )
You can’t perform that action at this time.
0 commit comments