paperchalice added a comment.

When I made D141907 <https://reviews.llvm.org/D141907>, I want 
`get_clang_resource_dir` in cmake and GetResourcesPath 
<https://clang.llvm.org/doxygen/CompilerInvocation_8cpp_source.html#l02913> in 
clang to have the same behavior and it also respects the doc string of 
`CLANG_RESOURCE_DIR`, but the behavior of `GetResourcesPath` itself is 
unintuitive when custom resource path is empty.

In D156270#4557902 <https://reviews.llvm.org/D156270#4557902>, @mgorny wrote:

> I'm not sure if it was really intended but the new API is kinda horrible, at 
> least for us in Gentoo.
>
> Our install prefix is `/usr/lib/llvm/NN`, whereas clang resource dir is 
> `/usr/lib/clang/NN`.
>
> If I don't override `CLANG_RESOURCE_DIR`, it infers the wrong directory:
> `/usr/lib/llvm/18/lib64/cmake/clang/../../..//lib64/clang/18`.

IIUC, the resource dir should be `/usr/lib/llvm/18/lib64/clang/18` when 
`CLANG_RESOURCE_DIR` is empty.

> To get the correct directory, I need to pass:
> `-DCLANG_RESOURCE_DIR="../../../clang/${LLVM_MAJOR}"`
> which is absolutely counterintuitive (the path gets appended to:
> `/usr/lib/llvm/18/lib64/cmake/clang/../../../bin`
> ).
>
> Not saying it's not workable but I'd hardly call that an improvement over the 
> previous API.
>
> CC @tstellar, @paperchalice.

The API here is indeed user unfriendly, a possible improvement is to let 
`CLANG_RESOURCE_DIR` aslo accept absolute path.
Also, `CLANG_RESOURCE_DIR` doesn't seem to work in standalone mode, some extra 
variables should be exported to `ClangConfig.cmake` e.g. the install prefix and 
bin dir of clang.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156270/new/

https://reviews.llvm.org/D156270

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to