From bf66b752b4aa4ef7a2c25795e53aeeaab32463ac Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Mon, 2 Oct 2023 10:46:59 +0100 Subject: [PATCH] Add custom config logic to 3rdparty modules These do not link directly against Mbed TLS so need their own propagation of the custom config values through CMake. Signed-off-by: David Horstmann --- 3rdparty/everest/CMakeLists.txt | 13 +++++++++++++ 3rdparty/p256-m/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/3rdparty/everest/CMakeLists.txt b/3rdparty/everest/CMakeLists.txt index 4ad367e17..ee86f1d7b 100644 --- a/3rdparty/everest/CMakeLists.txt +++ b/3rdparty/everest/CMakeLists.txt @@ -11,6 +11,19 @@ target_include_directories(everest include/everest/kremlib ${MBEDTLS_DIR}/library/) +# Pass-through MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE +# This must be duplicated from library/CMakeLists.txt because +# everest is not directly linked against any mbedtls targets +# so does not inherit the compile definitions. +if(MBEDTLS_CONFIG_FILE) + target_compile_definitions(everest + PUBLIC MBEDTLS_CONFIG_FILE="${MBEDTLS_CONFIG_FILE}") +endif() +if(MBEDTLS_USER_CONFIG_FILE) + target_compile_definitions(everest + PUBLIC MBEDTLS_USER_CONFIG_FILE="${MBEDTLS_USER_CONFIG_FILE}") +endif() + if(INSTALL_MBEDTLS_HEADERS) install(DIRECTORY include/everest diff --git a/3rdparty/p256-m/CMakeLists.txt b/3rdparty/p256-m/CMakeLists.txt index 0001dd2a8..7ff13084c 100644 --- a/3rdparty/p256-m/CMakeLists.txt +++ b/3rdparty/p256-m/CMakeLists.txt @@ -9,6 +9,19 @@ target_include_directories(p256m $ PRIVATE ${MBEDTLS_DIR}/library/) +# Pass-through MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE +# This must be duplicated from library/CMakeLists.txt because +# p256m is not directly linked against any mbedtls targets +# so does not inherit the compile definitions. +if(MBEDTLS_CONFIG_FILE) + target_compile_definitions(p256m + PUBLIC MBEDTLS_CONFIG_FILE="${MBEDTLS_CONFIG_FILE}") +endif() +if(MBEDTLS_USER_CONFIG_FILE) + target_compile_definitions(p256m + PUBLIC MBEDTLS_USER_CONFIG_FILE="${MBEDTLS_USER_CONFIG_FILE}") +endif() + if(INSTALL_MBEDTLS_HEADERS) install(DIRECTORY :${CMAKE_CURRENT_SOURCE_DIR}