[PATCH] D63881: [cmake] Fix build with BUILD_SHARED_LIBS=ON

Cristian Adam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 05:13:45 PDT 2019


cristian.adam added a comment.

In D63881#1571286 <https://reviews.llvm.org/D63881#1571286>, @beanz wrote:

> This is definitely not the right fix. We don’t want to set everything as Public dependencies. Our build system’s model for dependencies is that each component specified what it directly uses which is its Private dependencies. If you are having issues that probably means missing dependencies.


Well, at the moment the CMake build system is broken, `llvm/unittests/Passes` won't build when `BUILD_SHARED_LIBS` is set to `ON`.

The projects that consume the LLVM/Clang CMake exports need to explicitly link to all dependencies when Clang/LLVM is build with `BUILD_SHARED_LIBS` set to `ON`.

Qt Creator for example will not have the convenience of just saying `target_link_libraries(qtcreator PRIVATE libclang)`, which works fine with a static build of Clang/LLVM. Qt Creator will have to explicitly name the targets, in the worst case like `target_link_libraries(qtcreator PRIVATE libclang clangAST clangBasic clangFrontend clangIndex clangLex clangSema ...)`.

This is at least on Windows, where you need to use the DLL import libraries. On Linux you'll have problems because when I say "libclang" it will use the imported target "libclang" and not "-lclang", which might get the needed dependencies.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63881





More information about the llvm-commits mailing list