mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Pass MBEDTLS_CONFIG_FILE defines through cmake
When -DMBEDTLS_CONFIG_FILE or -DMBEDTLS_USER_CONFIG_FILE are passed to cmake, pass them through as compile definitions. This allows different mbedtls configs to be passed at configure time without modifying any cmake files. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
@ -10,6 +10,14 @@ if(NOT DEFINED MBEDTLS_DIR)
|
|||||||
set(MBEDTLS_DIR ${CMAKE_SOURCE_DIR})
|
set(MBEDTLS_DIR ${CMAKE_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# If set, make MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE into PATHs
|
||||||
|
if(DEFINED MBEDTLS_CONFIG_FILE)
|
||||||
|
set(MBEDTLS_CONFIG_FILE "" CACHE PATH "Mbed TLS config file (overrides default).")
|
||||||
|
endif()
|
||||||
|
if(DEFINED MBEDTLS_USER_CONFIG_FILE)
|
||||||
|
set(MBEDTLS_USER_CONFIG_FILE "" CACHE PATH "Mbed TLS user config file (appended to default).")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(src_crypto
|
set(src_crypto
|
||||||
aes.c
|
aes.c
|
||||||
aesni.c
|
aesni.c
|
||||||
@ -320,6 +328,15 @@ foreach(target IN LISTS target_libraries)
|
|||||||
PUBLIC $<BUILD_INTERFACE:${MBEDTLS_DIR}/include/>
|
PUBLIC $<BUILD_INTERFACE:${MBEDTLS_DIR}/include/>
|
||||||
$<INSTALL_INTERFACE:include/>
|
$<INSTALL_INTERFACE:include/>
|
||||||
PRIVATE ${MBEDTLS_DIR}/library/)
|
PRIVATE ${MBEDTLS_DIR}/library/)
|
||||||
|
# Pass-through MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE
|
||||||
|
if(DEFINED MBEDTLS_CONFIG_FILE)
|
||||||
|
target_compile_definitions(${target}
|
||||||
|
PUBLIC MBEDTLS_CONFIG_FILE="${MBEDTLS_CONFIG_FILE}")
|
||||||
|
endif()
|
||||||
|
if(DEFINED MBEDTLS_USER_CONFIG_FILE)
|
||||||
|
target_compile_definitions(${target}
|
||||||
|
PUBLIC MBEDTLS_USER_CONFIG_FILE="${MBEDTLS_USER_CONFIG_FILE}")
|
||||||
|
endif()
|
||||||
install(
|
install(
|
||||||
TARGETS ${target}
|
TARGETS ${target}
|
||||||
EXPORT MbedTLSTargets
|
EXPORT MbedTLSTargets
|
||||||
|
Reference in New Issue
Block a user