[clang] RFC: [cmake] Export CLANG_RESOURCE_DIR in ClangConfig (PR #97197)

Kim Gräsman via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 10:26:38 PDT 2024


kimgr wrote:

> Or making CustomResourceDir = CLANG_RESOURCE_DIR by default instead of "".

Binding that default value in Driver.h would leave it to external projects (using Clang) to resolve `CLANG_RESOURCE_DIR`, which is not available outside Clang. So it somehow needs to move into the body of `GetResourcesPath`.

Also, looking at the use of `CustomResourceDir`, it looks like it expects path relative to `dirname(clang)`, i.e. it would have to be something like ` `BinaryPath="/usr/lib/llvm-20/bin/clang"` and `{CLANG_RESOURCE_DIR,CustomResourceDir}="../share/my-tool/"`. Overall `CLANG_RESOURCE_DIR` and that custom resource dir seems pretty hard to get right, I wonder if it's ever used.

It was originally added to the LLVM CMake in https://github.com/llvm/llvm-project/commit/ffae4a66fa9de885382c48c725b1039593975986 and used in the subsequent https://github.com/llvm/llvm-project/commit/06067c556a0beb136bf3bb62f478269f67701486. I'm curious about these 'strange packaging environments" :)

https://github.com/llvm/llvm-project/pull/97197


More information about the cfe-commits mailing list