fix(tidy): find LLVM and Clang of the same installation

- Enable the C language before find_package(LLVM): LLVMConfig.cmake runs C
  compile checks and fails without it, e.g. with LLVM 17 on Ubuntu.
- Look for Clang next to the found LLVM first. Before, a failed LLVM
  lookup let Clang pull in another LLVM version silently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-09 22:38:18 +00:00
parent 85ab7e4b1c
commit 2fea52a071

View File

@@ -80,8 +80,9 @@ if(BUILD_TESTING)
endif()
if(BUILD_TIDY_TOOL)
enable_language(C) # LLVMConfig.cmake runs C compile checks
find_package2(PRIVATE LLVM REQUIRED)
find_package2(PRIVATE Clang REQUIRED)
find_package2(PRIVATE Clang REQUIRED CONFIG HINTS "${LLVM_LIBRARY_DIR}/cmake/clang")
set(Clang_VERSION ${LLVM_VERSION})
endif()