diff --git a/CMakeLists.txt b/CMakeLists.txt index 0810c31b..bcb7cb23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -387,10 +387,6 @@ if(CRYPTO_BACKEND STREQUAL "mbedTLS" OR NOT CRYPTO_BACKEND) list(APPEND LIBRARIES ${MBEDTLS_LIBRARIES}) list(APPEND LIBSSH2_PC_LIBS_PRIVATE "-lmbedcrypto") link_directories(${MBEDTLS_LIBRARY_DIR}) - - # mbedTLS (as of v3.5.1) has a duplicate function declaration - # in its own public headers. Disable the warning that detects it. - string(REGEX REPLACE "-Wredundant-decls" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") endif() endif() diff --git a/src/crypto.h b/src/crypto.h index 8307d77f..145dc88f 100644 --- a/src/crypto.h +++ b/src/crypto.h @@ -46,7 +46,16 @@ #elif defined(LIBSSH2_LIBGCRYPT) #include "libgcrypt.h" #elif defined(LIBSSH2_MBEDTLS) +/* mbedTLS (as of v3.5.1) has a duplicate function declaration + in its own public headers. Disable the warning that detects it. */ +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wredundant-decls" +#endif #include "mbedtls.h" +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #elif defined(LIBSSH2_OS400QC3) #include "os400qc3.h" #elif defined(LIBSSH2_WINCNG)