mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
[PR #655] CMake: Allow using BUILD_SHARED_LIBS to choose static/shared libs #1303
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/google/brotli/pull/655
State: closed
Merged: Yes
By convention projects using CMake which can build either static or shared libraries use a
BUILD_SHARED_LIBSflag to allow selecting between both: theadd_library()command automatically switches between both using this variable when the library kind is not passed toadd_library(). It is also usual to expose theBUILD_SHARED_LIBSas an user-facing setting with theoption()command.This way, the following will both work as expected:
This is helpful for distributions which need (or want) to build only static libraries.
The above being said, I understand that there might be some reason why it is desirable that both kinds of libraries are always built. If that is the case, let me know and I'll try to come up with some other way of allowing to only build static libraries, and installing them in a way that other projects trying to link with
-lbrotli*(and/or usingpkg-config) will find the static libraries.