Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: enable Seastar to build shared and static libs in a single build
before this change, we respect the CMake variable named `BUILD_SHARED_LIBS`, and build shared libraries if it is set, build static libraries otherwise. but this model cannot fulfill the needs of a parent project which needs to build both static and shared seastar libraries with different configuration in a multi-config generator settings. as `BUILD_SHARED_LIBS` is a CMake variable which cannot be changed at build time, and hence cannot be assigned with different values using generator expression. so, in this change, we add two options - Seastar_BUILD_STATIC_LIBS - Seastar_BUILD_SHARED_LIBS to configure if the build should generated static libraries and shared libraries respectively. but `BUILD_SHARED_LIBS` is still supported, and the behavior is backward compatible. the only user-visible differences are, the libraries of - seastar - seastar_testing - seastar_perf_testing are now aliases of the targets which builds the static or shared libraries. so one cannot build "seastar" as a target anymore, but should specify which library to build: ``` $ cmake --build build --target seastar # does not work anymore $ cmake --build build --target seastar-static $ cmake --build build --target seastar-shared ``` the reason is the limit of an ALIAS library, which cannot be used as a target. but we still need to use a non-interface library to generate .pc file, where, for instance, we use `$<TARGET_FILE_NAME:seastar_testing>` for the library list of a certain Seastar library. but a CMake-based project including seastar can still link against it using "seastar" as a library. Refs scylladb/scylladb#2717 Signed-off-by: Kefu Chai <[email protected]>
- Loading branch information