diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,6 +18,7 @@ option(ENABLE_HARDENING "Harden the executables" ON) option(ENABLE_GLIBC_BACK_COMPAT "Enable Glibc compatibility features" OFF) option(ENABLE_REDUCE_EXPORTS "Avoid exporting 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 @@ -56,6 +57,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)