Skip to content

Commit e4b1e54

Browse files
committed
configure or cmake sets LIBM variable if required, and write it in wolfssl.pc.
1 parent 24c30d9 commit e4b1e54

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

CMakeLists.txt

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

2579+
# Setting libm in Libs.private of wolfssl.pc.
2580+
# See "Link Libraries" in above about `m` insertion to LINK_LIBRARIES
2581+
get_target_property(_wolfssl_dep_libs wolfssl LINK_LIBRARIES)
2582+
list(FIND _wolfssl_dep_libs m _dep_libm)
2583+
if ("${_dep_libm}" GREATER -1)
2584+
set(LIBM -lm)
2585+
else()
2586+
set(LIBM)
2587+
endif()
2588+
25792589
configure_file(support/wolfssl.pc.in ${CMAKE_CURRENT_BINARY_DIR}/support/wolfssl.pc @ONLY)
25802590
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/support/wolfssl.pc
25812591
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9172,6 +9172,7 @@ AC_SUBST([AM_LDFLAGS])
91729172
AC_SUBST([AM_CCASFLAGS])
91739173
AC_SUBST([LIB_ADD])
91749174
AC_SUBST([LIB_STATIC_ADD])
9175+
AC_SUBST([LIBM])
91759176

91769177
# FINAL
91779178
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])

support/wolfssl.pc.in

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

0 commit comments

Comments
 (0)