]> git.ipfire.org Git - thirdparty/ccache.git/commit
fix: cmake -DSTATIC_LINK=ON on Linux/macOS (#1340)
authorRafael Kitover <rkitover@gmail.com>
Sun, 29 Oct 2023 08:28:15 +0000 (08:28 +0000)
committerGitHub <noreply@github.com>
Sun, 29 Oct 2023 08:28:15 +0000 (09:28 +0100)
commitd981073742a5645ae7e2e4eb19a39fa61dc1661e
tree31893cffa3594e1338d0a6227bc122aa8829970f
parent83ea900dab6ab00fc69f3803d0582fa828ba9f62
fix: cmake -DSTATIC_LINK=ON on Linux/macOS (#1340)

Make linking dependent libraries as static a hard requirement when
STATIC_LINK is ON, as opposed to the previous behavior of falling back
to dynamic libraries.

A side-effect of this is that if only a dynamic zstd/hiredis is
available on a system, it will not be found, and the download and build
code will be invoked to build a static version from the internet.

Add a general case to handle Linux, macOS and similar by linking
libgcc/libstdc++ statically on gcc/clang.

Move the code into cmake/StaticLinkSupport.cmake and include it from the
main file.

Fix #1330

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
CMakeLists.txt
cmake/StaticLinkSupport.cmake [new file with mode: 0644]