[PATCH] D61804: Support building shared and static libraries simultaneously

Wink Saville via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 12 10:54:18 PDT 2019


winksaville marked an inline comment as done.
winksaville added a comment.

In D61804#1499267 <https://reviews.llvm.org/D61804#1499267>, @beanz wrote:

> As an additional note, Arch linux should not be building clang with `BUILD_SHARED_LIBS` nor should it be distributing those ,so files. That isn't a supported configuration for Clang deployment.


Agreed, but I'd like to give them a choice of making both if I can get this accepted. It looks to me that llvm, libunwind and libcxx support building both, so the goal isn't unprecedented,



================
Comment at: clang/CMakeLists.txt:451
+option(CLANG_ENABLE_SHARED_LIBRARIES "Build libclang* as shared libraries." ON)
+option(CLANG_ENABLE_STATIC_LIBRARIES "Build libclang* as static libraries." ON)
+
----------------
beanz wrote:
> These shouldn't both default to `On`, that is a change in behavior that would be a build-time regression for anyone not interested in building shared libraries. `STATIC` should default `On`, and `SHARED` default `Off`.
> 
> Also you need to check that one of the two options is enabled. If both are `Off` confusing things will happen.
I'll change it to default SHARED OFF and STATIC ON.

When both are off it acts as it does without these changes, the default will depend on BUILD_SHARED_LIBS:
```
# llvm_add_library(name sources...
#   SHARED;STATIC
#     STATIC by default w/o BUILD_SHARED_LIBS.
#     SHARED by default w/  BUILD_SHARED_LIBS.
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61804





More information about the llvm-commits mailing list