Skip to content

Commit 88f0777

Browse files
authored
Merge pull request #7224 from mpsuzuki/pkg-config-static-link
Add "Libs.private: -m" to wolfssl.pc.in for a static linking
2 parents efda4b5 + e4b1e54 commit 88f0777

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,6 +2582,16 @@ if(WOLFSSL_INSTALL)
25822582
set(includedir "\${prefix}/include")
25832583
set(VERSION ${PROJECT_VERSION})
25842584

2585+
# Setting libm in Libs.private of wolfssl.pc.
2586+
# See "Link Libraries" in above about `m` insertion to LINK_LIBRARIES
2587+
get_target_property(_wolfssl_dep_libs wolfssl LINK_LIBRARIES)
2588+
list(FIND _wolfssl_dep_libs m _dep_libm)
2589+
if ("${_dep_libm}" GREATER -1)
2590+
set(LIBM -lm)
2591+
else()
2592+
set(LIBM)
2593+
endif()
2594+
25852595
configure_file(support/wolfssl.pc.in ${CMAKE_CURRENT_BINARY_DIR}/support/wolfssl.pc @ONLY)
25862596
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/support/wolfssl.pc
25872597
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9205,6 +9205,7 @@ AC_SUBST([AM_LDFLAGS])
92059205
AC_SUBST([AM_CCASFLAGS])
92069206
AC_SUBST([LIB_ADD])
92079207
AC_SUBST([LIB_STATIC_ADD])
9208+
AC_SUBST([LIBM])
92089209

92099210
# FINAL
92109211
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])

support/wolfssl.pc.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Name: wolfssl
77
Description: wolfssl C library.
88
Version: @VERSION@
99
Libs: -L${libdir} -lwolfssl
10+
Libs.private: @LIBM@
1011
Cflags: -I${includedir}

0 commit comments

Comments
 (0)