cmake: make system libraries dl, m, pthread customizable

via `DL_LIBRARY`, `MATH_LIBRARY`, `PTHREAD_LIBRARY` variables.

They are used in Rustls, wolfSSL Find modules.

Also:
- always use `NAMES` keyword in `find_library()` calls.
- respect `find_library()` results for `dl`, `m`, `pthread`.
- formatting.

Closes #15892
This commit is contained in:
Viktor Szakats 2025-01-01 22:55:07 +01:00
parent 9a9498ea1e
commit 27b9e76706
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
4 changed files with 32 additions and 30 deletions

View file

@ -91,9 +91,9 @@ else()
endif()
if(NOT WIN32)
find_library(_math_library "m")
if(_math_library)
list(APPEND WOLFSSL_LIBRARIES "m") # for log and pow
find_library(MATH_LIBRARY NAMES "m")
if(MATH_LIBRARY)
list(APPEND WOLFSSL_LIBRARIES ${MATH_LIBRARY}) # for log and pow
endif()
mark_as_advanced(_math_library)
mark_as_advanced(MATH_LIBRARY)
endif()