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/nanopb/nanopb.cmake b/external/nanopb/nanopb.cmake
index 92c6e5b..36465f6 100644
--- a/external/nanopb/nanopb.cmake
+++ b/external/nanopb/nanopb.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
#
@@ -75,7 +75,9 @@
)
unset(_cmake_fragment)
-#set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${NANOPB_INSTALL_DIR}/)
+if(TARGET stdlib::c)
+ target_link_libraries(nanopb::protobuf-nanopb-static INTERFACE stdlib::c)
+endif()
#### Build access to the protobuf compiler
#TODO: verify protoc dependencies: python3-protobuf