From: Tomer Lev Date: Thu, 12 Feb 2026 13:23:09 +0000 (+0200) Subject: cmake: add PKGCONFIG_EXTRA_LIBS option for pkg-config (#361) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3791575bbddd887046aa510193bea2cfacbb2fa;p=thirdparty%2Fvectorscan.git cmake: add PKGCONFIG_EXTRA_LIBS option for pkg-config (#361) Add a CMake cache variable to pass arbitrary flags to the pkg-config Libs line. This enables CGO builds using GCC (not g++) to link correctly by allowing users to specify C++ stdlib dependencies. Usage: cmake -DPKGCONFIG_EXTRA_LIBS="-lstdc++ -lm" ... --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 577f90e2..ea0ae710 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,6 +247,7 @@ set(HAVE_SHMGET ${HAVE_SHMGET} CACHE BOOL "shmget()") configure_file(${CMAKE_MODULE_PATH}/config.h.in ${PROJECT_BINARY_DIR}/config.h) configure_file(src/hs_version.h.in ${PROJECT_BINARY_DIR}/hs_version.h) +set(PKGCONFIG_EXTRA_LIBS "" CACHE STRING "Extra libraries to add to pkg-config Libs") configure_file(libhs.pc.in libhs.pc @ONLY) # only replace @ quoted vars install(FILES ${CMAKE_BINARY_DIR}/libhs.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") diff --git a/chimera/libch.pc.in b/chimera/libch.pc.in index 1eaf5bce..f3b37885 100644 --- a/chimera/libch.pc.in +++ b/chimera/libch.pc.in @@ -7,6 +7,6 @@ Name: libch Description: Intel(R) Chimera Library Version: @HS_VERSION@ Requires.private: libhs -Libs: -L${libdir} -lchimera +Libs: -L${libdir} -lchimera @PKGCONFIG_EXTRA_LIBS@ Libs.private: @PRIVATE_LIBS@ Cflags: -I${includedir}/hs diff --git a/libhs.pc.in b/libhs.pc.in index d1e3ffb0..85007156 100644 --- a/libhs.pc.in +++ b/libhs.pc.in @@ -6,5 +6,5 @@ includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ Name: libhs Description: A portable fork of the high-performance regular expression matching library Version: @HS_VERSION@ -Libs: -L${libdir} -lhs +Libs: -L${libdir} -lhs @PKGCONFIG_EXTRA_LIBS@ Cflags: -I${includedir}/hs