Fix libc dependency of external components
Currently the stdlib::c library, which represents the standard
library in deployments compiled for "freestanding" environments (SPs)
is added early to link dependencies of the target. As a result the
link order is incorrect and symbol search for external components
added later and depending on libc fails with GCC.
As a workaround make external components depend on libc directly.
Change-Id: Idb9da18bb8228dea56ef539cacf36964d2349937
Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
diff --git a/external/MbedTLS/MbedTLS.cmake b/external/MbedTLS/MbedTLS.cmake
index 88aa68b..83b190a 100644
--- a/external/MbedTLS/MbedTLS.cmake
+++ b/external/MbedTLS/MbedTLS.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -164,3 +164,6 @@
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${MBEDCRYPTO_LIB_FILE})
set_property(TARGET mbedcrypto PROPERTY IMPORTED_LOCATION ${MBEDCRYPTO_LIB_FILE})
set_property(TARGET mbedcrypto PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INSTALL_DIR}/include")
+if(TARGET stdlib::c)
+ target_link_libraries(mbedcrypto INTERFACE stdlib::c)
+endif()
\ No newline at end of file