From 390bdf2f785b03d93fa79def52f77248f8aa9e1f Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 17 May 2021 16:52:33 +0800 Subject: [PATCH] mbedtls: fixed CMake build warning Building mbedtls with CMake would warn that: "A private source from a directory other than that of target "mbedcrypto has a relative path" This happened due to some of the CMake variables listing sources could be empty. Changed to only use target_sources in the code-path where we set the sources, so we only call target_sources will non-empty variables. Closes https://github.com/espressif/esp-idf/issues/6767 --- components/mbedtls/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/mbedtls/CMakeLists.txt b/components/mbedtls/CMakeLists.txt index c97f337523..e7a26f0ff3 100644 --- a/components/mbedtls/CMakeLists.txt +++ b/components/mbedtls/CMakeLists.txt @@ -99,16 +99,19 @@ if(SHA_PERIPHERAL_TYPE STREQUAL "dma") set(SHA_DMA_SRCS "${COMPONENT_DIR}/port/sha/dma/esp_sha_gdma_impl.c" "${COMPONENT_DIR}/port/crypto_shared_gdma/esp_crypto_shared_gdma.c") endif() + target_sources(mbedcrypto PRIVATE "${SHA_DMA_SRCS}") endif() if(AES_PERIPHERAL_TYPE STREQUAL "dma") - target_include_directories(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/aes/dma/include") if(CONFIG_IDF_TARGET_ESP32S2) set(AES_DMA_SRCS "${COMPONENT_DIR}/port/aes/dma/esp_aes_crypto_dma_impl.c") else() set(AES_DMA_SRCS "${COMPONENT_DIR}/port/aes/dma/esp_aes_gdma_impl.c") endif() + + target_include_directories(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/aes/dma/include") + target_sources(mbedcrypto PRIVATE "${AES_DMA_SRCS}") endif() target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_hardware.c" @@ -119,8 +122,6 @@ target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_hardware.c" "${COMPONENT_DIR}/port/aes/esp_aes_common.c" "${COMPONENT_DIR}/port/aes/${AES_PERIPHERAL_TYPE}/esp_aes.c" "${COMPONENT_DIR}/port/sha/${SHA_PERIPHERAL_TYPE}/sha.c" - "${SHA_DMA_SRCS}" - "${AES_DMA_SRCS}" ) # CONFIG_ESP_TLS_USE_DS_PERIPHERAL can be enabled only for the supported targets.