[x265] [PATCH 6/6] CMake: Statically link libstdc++ when STATIC_LINK_CRT=ON

Hari Limaye hari.limaye at arm.com
Thu Oct 24 23:30:31 UTC 2024


Add -static-libstdc++ when compiling with STATIC_LINK_CRT=ON.
---
 source/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index fe9e6c9da..f15f413ac 100755
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -28,7 +28,7 @@ include(CheckCXXSourceCompiles)
 option(FPROFILE_GENERATE "Compile executable to generate usage data" OFF)
 option(FPROFILE_USE "Compile executable using generated usage data" OFF)
 option(NATIVE_BUILD "Target the build CPU" OFF)
-option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
+option(STATIC_LINK_CRT "Statically link C and C++ runtimes for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
 set(X265_BUILD 213)
@@ -446,7 +446,7 @@ int main() { return 0; }")
     endif(FPROFILE_USE)
     if(STATIC_LINK_CRT)
         add_definitions(-static)
-        list(APPEND LINKER_OPTIONS "-static-libgcc")
+        list(APPEND LINKER_OPTIONS "-static-libgcc -static-libstdc++")
     endif(STATIC_LINK_CRT)
     check_cxx_compiler_flag(-Wno-strict-overflow CC_HAS_NO_STRICT_OVERFLOW)
     check_cxx_compiler_flag(-Wno-narrowing CC_HAS_NO_NARROWING) 
-- 
2.42.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-CMake-Statically-link-libstdc-when-STATIC_LINK_CRT-O.patch
Type: text/x-patch
Size: 1731 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241025/cf45dbb1/attachment.bin>


More information about the x265-devel mailing list