[clang] RFC: [cmake] Export CLANG_RESOURCE_DIR in ClangConfig (PR #97197)
Kim Gräsman via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 1 03:40:42 PDT 2024
kimgr wrote:
@llvm-beanz
> @etcwilde's point above is that the CLANG_RESOURCE_DIR is already available in CMake for projects
> that import the Clang package or are built in-tree with Clang.
I don't think so. As far as I can tell:
* `clang-resource-headers` interface header dir would be the full path to the builtin headers dir, e.g. `/usr/lib/llvm-19/lib/clang/19/include`
* Unfortunately the Debian packages from apt.llvm.org don't define `clang-resource-headers`, though the target name is listed in `CLANG_EXPORTED_TARGETS`
* `clang-19 -print-resource-dir` prints the effective resource dir: `/usr/lib/llvm-19/lib/clang/19`
* `CLANG_RESOURCE_DIR` appears to be designed to be a relative path appended to `/usr/lib/llvm-19/{bin,lib}`
So I'm thinking even if the `clang-resource-headers` target was available, it would not give the path to the resource dir, but rather the path to the subdir containing the builtin headers. That might be fine, i.e. I could take that path and add it with `-isystem ...`, but if the resource dir is already implicitly on the header search path, that seems preferable.
https://github.com/llvm/llvm-project/pull/97197
More information about the cfe-commits
mailing list