[WIP] Separate building static and shared libs
Introduce separating building static and shared libs, depends on cmake out-of-the-box option BUILD_SHARED_LIBS https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html. Also creates alias target for transparently linking to static or shared lib.
Ok, @Enmk
- Reason: i wanna provide a conan recipe to conan-center-index for clickhouse-cpp. Conan does not support static and shared libs at the same time. Library should be build as static or as shared.
- Ok, i'll try to figure out how to do that and change pr
- If project uses library with cmake FetchContent or as subdirectory project may depend on static target name. If we change target name for static libs it will be cmake error. There is only one reason why I do not change target name for static.
Regarding the CI/CD testing: IMO you might want to add another matrix parameter, like here. Something like:
matrix:
compiler: [clang-6, gcc-7, gcc-8, gcc-9]
ssl: [ssl_ON, ssl_OFF]
+ build_type: [static, shared]
include:
...
+ - build_type: shared
+ CMAKE_BUILD_TYPE_FLAG: -BUILD_SHARED_LIBS=ON
etc.
Also, if you wish to add clickhouse-cpp as a Conan module, please free to add any related CI/CD workflows
Regarding the CI/CD testing: IMO you might want to add another matrix parameter,
I did this but looks like windows shared build is broken
If someone can help with windows shared build with export all, it will be nice
If someone can help with windows shared build with export all, it will be nice
Addressed in #226
CI/CD workflows, the exe maybe miss the dll, be careful of their path
Another attempt to fix windows build here: #227 227
@Enmk I dropped support for shared builds for windows and macos due to platforms require exporting symbols. Also @1261385937 will close his draft https://github.com/ClickHouse/clickhouse-cpp/pull/226#issuecomment-1361137815