[PATCH] D134637: clang-tblgen build: avoid duplicate inclusion of libLLVMSupport

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 12 10:23:49 PDT 2022


phosek added a comment.

In D134637#3835935 <https://reviews.llvm.org/D134637#3835935>, @nhaehnle wrote:

> Thank you all for the reviews. I've integrated the suggestions except for:
>
>> A possible alternative solution would be to build clangSupport_sources as an object library, and then link that library into clangSupport and clang-tblgen which could be done unconditionally; the advantage is that you don't need to compile clangSupport_sources twice.
>
> I'm not sure how this would work. It doesn't seem to be something with precedent in the LLVM tree, and seems to require using raw CMake `add_library`, though it's quite likely that I missed something?

We support building object libraries, see https://github.com/llvm/llvm-project/blob/702d937f1e1d42892ab43d1b591f5041ce2f4e78/llvm/cmake/modules/AddLLVM.cmake#L443, which should be already set for `clangSupport`, see https://github.com/llvm/llvm-project/blob/702d937f1e1d42892ab43d1b591f5041ce2f4e78/clang/cmake/modules/AddClang.cmake#L102. In this case, it may be sufficient, to just link `obj.clangSupport` (that is, you'd use `target_link_libraries(clang-tblgen PRIVATE obj.clangSupport)`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134637



More information about the cfe-commits mailing list