diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,6 +17,7 @@ option(BUILD_BITCOIN_QT "Build bitcoin-qt" ON) option(ENABLE_HARDENING "Harden the executables" ON) option(ENABLE_REDUCE_EXPORTS "Reduce the amount of exported symbols" OFF) +option(ENABLE_STATIC_LIBSTDCXX "Statically link libstdc++" OFF) # Cmake uses the CMAKE_BUILD_TYPE variable to select the build configuration. # By default it supports more configurations that needed for Bitcoin ABC, and @@ -65,6 +66,11 @@ add_linker_flag(-Wl,--exclude-libs,ALL) endif() +# Enable statically linking libstdc++ +if(ENABLE_STATIC_LIBSTDCXX) + add_linker_flag(-static-libstdc++) +endif() + # All windows code is PIC, forcing it on just adds useless compile warnings if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") add_compiler_flag(-fPIC)