zephyr/cmake/linker/lld/linker_libraries.cmake
Torsten Rasmussen d2896df821 cmake: set minimal C++ linker properties in minimal C++ CMake impl
The property based toolchain integration allows a cleaner design by
letting the toolchain define its properties and values and let CMake
implementation of Zephyr provided C and C++ libraries adjust those
properties when minimal C or C++ libraries are used.

This commit moves handling of C++ linker library properties into
the minimal C++ CMake implementation.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-11-16 15:28:20 -05:00

20 lines
835 B
CMake

# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0
set_linker_property(NO_CREATE TARGET linker PROPERTY c_library "-lc")
# Default per standard, will be populated by clang/target.cmake based on clang output.
set_linker_property(NO_CREATE TARGET linker PROPERTY rt_library "")
set_linker_property(TARGET linker PROPERTY c++_library "-lc++;-lc++abi")
if(CONFIG_CPP
AND NOT CONFIG_NATIVE_LIBRARY
# When new link principle is fully introduced, then the below condition can
# be removed, and instead the external module c++ should use:
# set_property(TARGET linker PROPERTY c++_library "<external_c++_lib>")
AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP
)
set_property(TARGET linker PROPERTY link_order_library "c++")
endif()
set_property(TARGET linker APPEND PROPERTY link_order_library "c;rt")