Merge pull request #5984 from embhorn/zd15493

Fix Cmake to exclude libm when DH is not enabled
This commit is contained in:
David Garske
2023-01-20 11:21:09 -08:00
committed by GitHub

View File

@@ -931,7 +931,7 @@ endif()
# DH # DH
add_option("WOLFSSL_DH" add_option("WOLFSSL_DH"
"Enable DH (default: enabled)" "Enable DH (default: enabled)"
"yes" "yes;no") "yes" "yes;no;const")
if(WOLFSSL_OPENSSH) if(WOLFSSL_OPENSSH)
override_cache(WOLFSSL_DH "yes") override_cache(WOLFSSL_DH "yes")
@@ -946,6 +946,11 @@ else()
endif() endif()
endif() endif()
if("${WOLFSSL_DH}" STREQUAL "const")
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_DH_CONST")
set(WOLFSSL_DH_CONST "yes")
endif()
# TODO: - Anonymous # TODO: - Anonymous
# ASN # ASN
@@ -1949,10 +1954,12 @@ elseif(APPLE)
${SECURITY_FRAMEWORK}) ${SECURITY_FRAMEWORK})
endif() endif()
else() else()
# DH requires math (m) library if(WOLFSSL_DH AND NOT WOLFSSL_DH_CONST)
target_link_libraries(wolfssl # DH requires math (m) library
PUBLIC target_link_libraries(wolfssl
m) PUBLIC
m)
endif()
endif() endif()
#################################################### ####################################################