[PATCH] D46522: [clang] cmake: resolve symlinks in ClangConfig.cmake

Peter Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 8 04:11:47 PDT 2018


Lekensteyn added reviewers: brad.king, gottesmm, mgorny.
Lekensteyn added a comment.

Hi, this patch was required to make `find_package(Clang CONFIG)` work when `/usr/lib/llvm/clang-X.Y` was a symlink and is integrated in the Debian packaging. Please have a look, thanks!

One unfortunate limitation (that existed before) is that `find_package(Clang 5.0)` does not work because `CLANG_VERSION_*` is not defined. So
`find_package(LLVM 6.0)` could locate `/usr/lib/cmake/llvm-6.0/LLVMConfig.cmake` but then
`find_package(Clang)` could end up using `/usr/lib/cmake/clang-5.0`. (This was discovered while testing a Clang 6.0 build on a system with Clang 5.0 co-installed.)

The reason for me to use different Clang versions is for CI purposes. As such, I am currently using `CMAKE_PREFIX_PATH=/usr/lib/llvm-6.0` which will find the correct version without explicitly having to specify it in `find_package`.


Repository:
  rC Clang

https://reviews.llvm.org/D46522





More information about the cfe-commits mailing list