cmake: allow to bundle static dependencies in main project
The BUILD_STATIC cmake config option forces the build system link Tarantool binary statically with its dependencies. It expects that all static libraries on which Tarantool binary depends are available at build time. We don't use this option directly to create static binaries because it would produce different results on different build systems. Instead, we use the separate cmake config located in the static-build directory, which fetches all Tarantool dependencies from a predefined location before building a static binary. Having a separate cmake config is inconvenient. Let's enable bundling of static binary dependencies right in the main project cmake config, like we bundle, for example, libcurl. To achieve that, the new build option was introduced BUILD_STATIC_WITH_BUNDLED_LIBS. It implies BUILD_STATIC and also fetches and builds all required dependencies, like the static-build cmake config used to. The latter doesn't do it anymore; from now on, it just sets BUILD_STATIC_WITH_BUNDLED_LIBS when building Tarantool. We can't remove the static-build cmake config yet because there are quire a few CI workflows depending on it. Note that, just like BUILD_STATIC, BUILD_STATIC_WITH_BUNDLED_LIBS doesn't imply OPENSSL_USE_STATIC_LIBS so the latter should be set explicitly if one wants to use the static openssl library. However, setting OPENSSL_USE_STATIC_LIBS with BUILD_STATIC_WITH_BUNDLED_LIBS will force the build system use bundled static openssl library. This patch is relatively straightforward. It just moves the external projects from /static-build/cmake/AddDependencyProjects.cmake to /cmake adding build dependencies where required and setting variables that are set by the corresponding /cmake/FindXXX.cmake configs. There are a few things that should be noted separately though: - We dropped the ZLIB_FOUND check from the main project cmake config. It was used for building EE but the latter is going to be broken anyway once this patch is committed. We'll fix it in following commits. - FindLibUnwind referenced zlib library by ZLIB::ZLIB. We don't set it for bundled zlib so let's use ZLIB_LIBRARIES instead. - We don't need to detect dependency cflags while building bundled libraries as we can reuse the flags set by the main project. - We don't use HARDENING_LDFLAGS because it makes no sense when building static libraries. Closes #9242 NO_DOC=build NO_TEST=build NO_CHANGELOG=build
Showing
- .gitignore 0 additions, 1 deletion.gitignore
- CMakeLists.txt 68 additions, 15 deletionsCMakeLists.txt
- cmake/BuildICONV.cmake 42 additions, 0 deletionscmake/BuildICONV.cmake
- cmake/BuildICU.cmake 77 additions, 0 deletionscmake/BuildICU.cmake
- cmake/BuildLibCURL.cmake 8 additions, 0 deletionscmake/BuildLibCURL.cmake
- cmake/BuildLibYAML.cmake 4 additions, 0 deletionscmake/BuildLibYAML.cmake
- cmake/BuildOpenSSL.cmake 57 additions, 0 deletionscmake/BuildOpenSSL.cmake
- cmake/BuildReadline.cmake 104 additions, 0 deletionscmake/BuildReadline.cmake
- cmake/BuildZLIB.cmake 39 additions, 0 deletionscmake/BuildZLIB.cmake
- cmake/FindLibUnwind.cmake 1 addition, 1 deletioncmake/FindLibUnwind.cmake
- patches/icu-tarantool-security-45.patch 0 additions, 0 deletionspatches/icu-tarantool-security-45.patch
- patches/icu-tarantool-security-59.patch 0 additions, 0 deletionspatches/icu-tarantool-security-59.patch
- patches/icu-tarantool-security-61.patch 0 additions, 0 deletionspatches/icu-tarantool-security-61.patch
- patches/icu-tarantool-security-96.patch 0 additions, 0 deletionspatches/icu-tarantool-security-96.patch
- patches/openssl-111q-gh-18720.patch 0 additions, 0 deletionspatches/openssl-111q-gh-18720.patch
- patches/openssl-tarantool-security-27.patch 0 additions, 0 deletionspatches/openssl-tarantool-security-27.patch
- patches/openssl-tarantool-security-54.patch 0 additions, 0 deletionspatches/openssl-tarantool-security-54.patch
- patches/openssl-tarantool-security-90.patch 0 additions, 0 deletionspatches/openssl-tarantool-security-90.patch
- patches/readline-tarantool-security-95.patch 0 additions, 0 deletionspatches/readline-tarantool-security-95.patch
- patches/readline80-001.patch 0 additions, 0 deletionspatches/readline80-001.patch
Loading
Please register or sign in to comment