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

Kim Gräsman via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 13 01:40:33 PDT 2024


kimgr wrote:

@llvm-beanz Thanks! Yes, copying the headers does seem like a hack, in retrospect. I think I started down that path because I don't know how packaging works -- I had assumed I might have to bundle the headers with IWYU, but I guess the right procedure is to build against an installed Clang, wire the paths for that installation, and express a dependency in the resulting package?

So is the recommendation to:

* feed path to Clang binary in from CMake via preprocessor symbol or something (where do I find that on the CMake side, btw?)
* `resPath = GetResourcesPath(clangBinaryPath)`
* Add a `-resource-dir $resPath` switch as part of driver construction

?

@etcwilde Cool, that might be helpful! I don't need it on the include path, I need to somehow forward it into my tool so it will be able to find <stddef.h> and friends at runtime. Your last example appears to get the path in a form where that's possible, thanks!

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


More information about the cfe-commits mailing list