Skip to content

Commit

Permalink
mbedtls: fixed CMake build warning
Browse files Browse the repository at this point in the history
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 #6767
  • Loading branch information
ESP-Marius committed May 19, 2021
1 parent 6be10fa commit 390bdf2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/mbedtls/CMakeLists.txt
Expand Up @@ -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"
Expand All @@ -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.
Expand Down

0 comments on commit 390bdf2

Please sign in to comment.