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
>From f11ba6d811a2ff7e3dd15aa9a44715bddf807b2e Mon Sep 17 00:00:00 2001 Message-ID: <f11ba6d811a2ff7e3dd15aa9a44715bddf807b2e.1729809914.git.hari.lim...@arm.com> In-Reply-To: <cover.1729809914.git.hari.lim...@arm.com> References: <cover.1729809914.git.hari.lim...@arm.com> From: Hari Limaye <hari.lim...@arm.com> Date: Thu, 24 Oct 2024 23:18:30 +0100 Subject: [PATCH 6/6] CMake: Statically link libstdc++ when STATIC_LINK_CRT=ON 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
_______________________________________________ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel