From 7e203c15e6be738944a467212a4a4d232af390f7 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 18 Feb 2026 13:21:19 +0100 Subject: [PATCH] cmake/FindMbedTLS: add workaround for missing static MSVC `mbedcrypto.lib` 4.0.0 Seen with mbedTLS 4.0.0. mbedTLS 4.0.0 renamed `mbedcrypto` lib to `tfpsacrypto`, while also keeping a copy under the old name to aid transition. However, this compatibility logic is broken for MSVC static builds, and the old name missing. Work around by looking for the new name in the raw detection codepath. Note that using `pkg-config`-based detection also works as a workaround. Reported-by: tawmoto on github Fixes #20616 Ref: https://github.com/Mbed-TLS/mbedtls/blob/v4.0.0/library/CMakeLists.txt#L275-L282 Ref: https://github.com/Mbed-TLS/mbedtls/issues/10605 Closes #20617 --- CMake/FindMbedTLS.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMake/FindMbedTLS.cmake b/CMake/FindMbedTLS.cmake index 986f187802..8b67ce9acf 100644 --- a/CMake/FindMbedTLS.cmake +++ b/CMake/FindMbedTLS.cmake @@ -72,11 +72,12 @@ else() if(MBEDTLS_USE_STATIC_LIBS) find_library(MBEDTLS_LIBRARY NAMES "mbedtls_static" "libmbedtls_static" "mbedtls" "libmbedtls") find_library(MBEDX509_LIBRARY NAMES "mbedx509_static" "libmbedx509_static" "mbedx509" "libmbedx509") - find_library(MBEDCRYPTO_LIBRARY NAMES "mbedcrypto_static" "libmbedcrypto_static" "mbedcrypto" "libmbedcrypto") + find_library(MBEDCRYPTO_LIBRARY NAMES "mbedcrypto_static" "libmbedcrypto_static" "mbedcrypto" "libmbedcrypto" + "tfpsacrypto_static" "libtfpsacrypto_static" "tfpsacrypto" "libtfpsacrypto") else() find_library(MBEDTLS_LIBRARY NAMES "mbedtls" "libmbedtls") find_library(MBEDX509_LIBRARY NAMES "mbedx509" "libmbedx509") - find_library(MBEDCRYPTO_LIBRARY NAMES "mbedcrypto" "libmbedcrypto") + find_library(MBEDCRYPTO_LIBRARY NAMES "mbedcrypto" "libmbedcrypto" "tfpsacrypto" "libtfpsacrypto") endif() unset(MBEDTLS_VERSION CACHE)