From 3db09aa610937bfe85f0823d32cd7c9474b12158 Mon Sep 17 00:00:00 2001 From: Mark Ruvald Pedersen Date: Fri, 26 Apr 2019 08:43:04 +0200 Subject: [PATCH] cmake: Toolchain abstraction: introduce toolchain_ld_cpp No functional change expected. This is motivated by the wish to abstract Zephyr's usage of toolchains, permitting non-intrusive porting to other (commercial) toolchains. Signed-off-by: Mark Ruvald Pedersen --- CMakeLists.txt | 5 ++--- cmake/linker/ld/target.cmake | 1 + cmake/linker/ld/target_cpp.cmake | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 cmake/linker/ld/target_cpp.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index efc10de2503..33c1899b523 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -230,9 +230,8 @@ if(NOT CONFIG_NATIVE_APPLICATION) endif() if(CONFIG_LIB_CPLUSPLUS) -zephyr_ld_options( - -lstdc++ -) + # @Intent: Set linker specific flags for C++ + toolchain_ld_cpp() endif() # ========================================================================== diff --git a/cmake/linker/ld/target.cmake b/cmake/linker/ld/target.cmake index ae5b2834448..2dbd87cf945 100644 --- a/cmake/linker/ld/target.cmake +++ b/cmake/linker/ld/target.cmake @@ -7,3 +7,4 @@ set_ifndef(LINKERFLAGPREFIX -Wl) # Load toolchain_ld-family macros include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_base.cmake) include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_baremetal.cmake) +include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_cpp.cmake) diff --git a/cmake/linker/ld/target_cpp.cmake b/cmake/linker/ld/target_cpp.cmake new file mode 100644 index 00000000000..89dca592ccc --- /dev/null +++ b/cmake/linker/ld/target_cpp.cmake @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + +# See root CMakeLists.txt for description and expectations of these macros + +macro(toolchain_ld_cpp) + + zephyr_ld_options( + -lstdc++ + ) + +endmacro()