[clang] RFC: [cmake] Export CLANG_RESOURCE_DIR in ClangConfig (PR #97197)
Tulio Magno Quites Machado Filho via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 25 14:52:26 PDT 2024
tuliom wrote:
> `clang::Driver` has this method which allows you to specify the starting path for the clang installation to use for the resource lookup.
>
> ```c++
> /// Takes the path to a binary that's either in bin/ or lib/ and returns
> /// the path to clang's resource directory.
> static std::string GetResourcesPath(StringRef BinaryPath,
> StringRef CustomResourceDir = "");
> ```
I don't think an implementation based on `GetResourcesPath()` will work outside of Clang.
In order for this function to return the correct PATH for all scenarios, we need that `CustomResourceDir=CLANG_RESOURCE_DIR`.
That forces us back to the original discussion about exporting `CLANG_RESOURCE_DIR`.
Here is an example on how this function is used in Clang:
https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/Driver.cpp#L242
https://github.com/llvm/llvm-project/pull/97197
More information about the cfe-commits
mailing list