1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

cmake: mbedtls: extra CMAKE_REQUIRED_INCLUDES

Make sure MBEDTLS_INCLUDE_DIRS and MBEDTLS_LIBRARIES are set in parent CMakeLists

Also set MBEDTLS_INCLUDE_DIRS in CMAKE_REQUIRED_INCLUDES so the CHECK_C_SOURCE_COMPILES
checks actually evaluate properly.
This commit is contained in:
Nikias Bassen 2021-07-12 19:09:43 +02:00 committed by Andy Green
parent 6852c3c64d
commit ed7215f373
2 changed files with 4 additions and 0 deletions

View file

@ -362,6 +362,7 @@ if (LWS_WITH_MBEDTLS)
set(LWS_HAVE_X509_VERIFY_PARAM_set1_host 1 PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MBEDTLS_INCLUDE_DIRS})
CHECK_C_SOURCE_COMPILES("#include <mbedtls/x509_crt.h>\nint main(void) { struct mbedtls_x509_crt c; c.authority_key_id.keyIdentifier.tag = MBEDTLS_ASN1_OCTET_STRING; return c.authority_key_id.keyIdentifier.tag; }\n" LWS_HAVE_MBEDTLS_AUTH_KEY_ID)
CHECK_C_SOURCE_COMPILES("#include <mbedtls/ssl.h>\nint main(void) { void *v = (void *)mbedtls_ssl_set_verify; return !!v; }\n" LWS_HAVE_mbedtls_ssl_set_verify)
CHECK_FUNCTION_EXISTS(mbedtls_ssl_conf_alpn_protocols LWS_HAVE_mbedtls_ssl_conf_alpn_protocols PARENT_SCOPE)

View file

@ -105,13 +105,16 @@ include_directories(wrapper/include wrapper/include/internal)
endif()
if (LWS_MBEDTLS_LIBRARIES)
set(MBEDTLS_LIBRARIES ${LWS_MBEDTLS_LIBRARIES})
set(MBEDTLS_LIBRARIES ${LWS_MBEDTLS_LIBRARIES} PARENT_SCOPE)
endif()
if (LWS_MBEDTLS_INCLUDE_DIRS)
set(MBEDTLS_INCLUDE_DIRS ${LWS_MBEDTLS_INCLUDE_DIRS})
set(MBEDTLS_INCLUDE_DIRS ${LWS_MBEDTLS_INCLUDE_DIRS} PARENT_SCOPE)
endif()
set(USE_MBEDTLS 1 PARENT_SCOPE)
if (DEFINED MBEDTLS_INCLUDE_DIRS)
include_directories(${MBEDTLS_INCLUDE_DIRS})
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MBEDTLS_INCLUDE_DIRS})
endif()
if (DEFINED MBEDTLS_LIBRARIES)