From 510abe6bea3d75473589992c227a474564c0a77d Mon Sep 17 00:00:00 2001 From: meowtec Date: Thu, 23 Nov 2023 19:06:55 +0800 Subject: [PATCH] Fix private libraries for libcpp --- CMakeLists.txt | 8 ++++++++ libde265.pc.in | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea8e183d..2444c78a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,14 @@ if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} MATCHES Clang) add_definitions(-Wall) endif() +include(CheckCXXSymbolExists) +check_cxx_symbol_exists(_LIBCPP_VERSION cstdlib HAVE_LIBCPP) +if(HAVE_LIBCPP) + set(LIBS_PRIVATE "-lc++") +else() + set(LIBS_PRIVATE "-lstdc++") +endif() + option(BUILD_SHARED_LIBS "Build shared library" ON) if(NOT BUILD_SHARED_LIBS) add_definitions(-DLIBDE265_STATIC_BUILD) diff --git a/libde265.pc.in b/libde265.pc.in index e3f23ed8..027062d7 100644 --- a/libde265.pc.in +++ b/libde265.pc.in @@ -7,7 +7,7 @@ Name: libde265 Description: H.265/HEVC video decoder. URL: https://github.com/strukturag/libde265 Version: @VERSION@ -Requires: +Requires: Libs: -lde265 -L${libdir} -Libs.private: @LIBS@ -lstdc++ +Libs.private: @LIBS_PRIVATE@ Cflags: -I${includedir}