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
This commit is contained in:
Luca Rood 2019-03-02 02:53:09 +01:00
parent 490a385c81
commit d5c2be7031
Notes: blender-bot 2023-02-14 01:07:44 +01:00
Referenced by commit e72bbd3805, Revert accidental change in submodules from last commit
4 changed files with 7 additions and 3 deletions

View File

@ -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)

@ -1 +1 @@
Subproject commit 29c2218102135522d6e2cd4bba7ab47d7241ab8a
Subproject commit f81ed052157aff3979763cf25840032d11d261b6

@ -1 +1 @@
Subproject commit c94604993b3e0bfbc733861e890aff18513e02b4
Subproject commit 26330ab14347cef00d67e2e4335c9609082e227b

@ -1 +1 @@
Subproject commit 3a80a18ea081ff93f4b3672120b446b7adc93e81
Subproject commit 57596569d9bc50230a0430e7ed159c963c00814c