diff options
author | Luca Rood <dev@lucarood.com> | 2019-03-02 04:53:09 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2019-03-02 04:53:09 +0300 |
commit | d5c2be7031912cca8f58e90283eb52f63f71b32f (patch) | |
tree | 9a3061a1aea0d090d5ebb01820ebabb3d1c6ab22 /build_files | |
parent | 490a385c8124dea09c3d06cc0dd546189bc6ec11 (diff) |
CMake: Use static libstdc++ for static builds
This enables static linking of libstdc++ by default when building using
`WITH_STATIC_LIBS`. This makes builds more portable for anyone making
static builds (in particular for older systems).
Reviewed By: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4393
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/cmake/platform/platform_unix.cmake | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 2bfc4cda20c..0d486c84fe6 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -39,6 +39,10 @@ if(EXISTS ${LIBDIR}) set(WITH_OPENMP_STATIC ON) endif() +if(WITH_STATIC_LIBS) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++") +endif() + # Wrapper to prefer static libraries macro(find_package_wrapper) if(WITH_STATIC_LIBS) |