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

Hari Limaye hari.limaye at arm.com
Wed Nov 6 15:37:26 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 5c1ae2359..310683909 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: v2-0006-CMake-Statically-link-libstdc-when-STATIC_LINK_CR.patch
Type: text/x-patch
Size: 1679 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241106/71547990/attachment-0001.bin>


More information about the x265-devel mailing list