| Summary: | Specifying LLVM_DIR causes Clang not to be found. | ||
|---|---|---|---|
| Product: | [Applications] kdevelop | Reporter: | bungeman |
| Component: | Build tools: CMake | Assignee: | kdevelop-bugs-null |
| Status: | REPORTED --- | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | git master | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
SUMMARY I am on a system where clang-12 is the default but wish to build KDevelop against clang-13. I can install clang-13 and its dev packages, and set `cmake-options -DLLVM_DIR=/usr/lib/llvm-13` in my `~/.kdesrc-buildrc`. This allows llvm-13 to be found, but the cmake build steps fail to find the clang-13 libraries. The issue appears to be that in `cmake/modules/FindClang.cmake` if `LLVM_DIR` is set `find_package(LLVM ${version})` is not executed at all, which means that none of its side effects are made available (like setting (LLVM_FOUND, LLVM_LIBRARY_DIRS, etc). Simply removing `LLVM_DIR OR ` from this file allows the correct clang-13 libraries to be found and the build succeeds. STEPS TO REPRODUCE 1. Set `cmake-options -DLLVM_DIR=/usr/lib/llvm-13` in `~/.kdesrc-buildrc`, or otherwise get LLVM_DIR to CMake. 2. Run CMake. OBSERVED RESULT CMake finds LLVM fine, but then fails to find Clang libraries. EXPECTED RESULT CMake should find the Clang libraries.