From e52783017eeb6093a8bac160d6125d658664eebb Mon Sep 17 00:00:00 2001 From: Matthew Barr Date: Wed, 27 Apr 2016 15:05:44 +1000 Subject: [PATCH] pkgconfig: Add Libs.private for static linking --- CMakeLists.txt | 8 ++++++++ libhs.pc.in | 1 + 2 files changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10a7b359..7439f50b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -349,6 +349,14 @@ 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) if (NOT WIN32) + # expand out library names for pkgconfig static link info + foreach (LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}) + # this is fragile, but protects us from toolchain specific files + if (NOT EXISTS ${LIB}) + set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}") + endif() + endforeach() + configure_file(libhs.pc.in libhs.pc @ONLY) # only replace @ quoted vars install(FILES ${CMAKE_BINARY_DIR}/libhs.pc DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig") diff --git a/libhs.pc.in b/libhs.pc.in index b67f9de6..e16460e8 100644 --- a/libhs.pc.in +++ b/libhs.pc.in @@ -7,4 +7,5 @@ Name: libhs Description: Intel(R) Hyperscan Library Version: @HS_VERSION@ Libs: -L${libdir} -lhs +Libs.private: @PRIVATE_LIBS@ Cflags: -I${includedir}/hs