From 68dfa900a59940242d6881541164eac70449c943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Komar=C4=8Devi=C4=87?= Date: Tue, 17 Oct 2023 10:21:19 +0200 Subject: [PATCH] CMake: detect C++ library for pkgconf file --- CMakeLists.txt | 8 ++++++++ libheif.pc.in | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a61145b324..c6a96ce9c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,6 +255,14 @@ if (LIBSHARPYUV_FOUND) endif() list(JOIN REQUIRES_PRIVATE " " REQUIRES_PRIVATE) +include(CheckCXXSymbolExists) +check_cxx_symbol_exists(_LIBCPP_VERSION cstdlib HAVE_LIBCPP) +if(HAVE_LIBCPP) + set(LIBS_PRIVATE "-lc++") +else() + set(LIBS_PRIVATE "-lstdc++") +endif() + configure_file(libheif.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libheif.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libheif.pc diff --git a/libheif.pc.in b/libheif.pc.in index 710aed0c6d..24bef6d67f 100644 --- a/libheif.pc.in +++ b/libheif.pc.in @@ -19,5 +19,5 @@ Version: @PROJECT_VERSION@ Requires: Requires.private: @REQUIRES_PRIVATE@ Libs: -L${libdir} -lheif -Libs.private: @LIBS@ +Libs.private: @LIBS_PRIVATE@ Cflags: -I${includedir}