]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
cmake: add PKGCONFIG_EXTRA_LIBS option for pkg-config (#361)
authorTomer Lev <me@tomerlev.com>
Thu, 12 Feb 2026 13:23:09 +0000 (15:23 +0200)
committerGitHub <noreply@github.com>
Thu, 12 Feb 2026 13:23:09 +0000 (15:23 +0200)
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" ...

CMakeLists.txt
chimera/libch.pc.in
libhs.pc.in

index 577f90e28bb56b8a77c3d4daa1ef25a434d0ab40..ea0ae710fb34e24526039d9e956a649dc6f0edfb 100644 (file)
@@ -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")
index 1eaf5bce56ada993b9a02f01afa5467b4908cf9f..f3b378856f27f1b11cb2d5647fb46a5841b4d4ea 100644 (file)
@@ -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
index d1e3ffb0e6bdf06087b41e1b5893634ca8d5cfa7..85007156839c92bc01ff89bfcb0e7bcbd850eb30 100644 (file)
@@ -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