CMake: pass predefined macros to ARM toolchain linker

pull/13930/head
Lingkai Dong 2020-11-19 15:26:49 +00:00
parent 80a0a5b440
commit 9bf6affc74
1 changed files with 2 additions and 1 deletions

View File

@ -132,8 +132,8 @@ endfunction()
#
function(mbed_set_mbed_target_linker_script target)
get_property(mbed_target_linker_script GLOBAL PROPERTY MBED_TARGET_LINKER_FILE)
mbed_generate_options_for_linker(${target} _linker_preprocess_definitions)
if(MBED_TOOLCHAIN STREQUAL "GCC_ARM")
mbed_generate_options_for_linker(${target} _linker_preprocess_definitions)
set(CMAKE_PRE_BUILD_COMMAND
COMMAND "arm-none-eabi-cpp" ${_linker_preprocess_definitions} -x assembler-with-cpp -E -Wp,-P
${mbed_target_linker_script} -o ${CMAKE_BINARY_DIR}/${target}.link_script.ld
@ -146,6 +146,7 @@ function(mbed_set_mbed_target_linker_script target)
target_link_options(mbed-core
INTERFACE
"--scatter=${mbed_target_linker_script}"
"--predefine=${_linker_preprocess_definitions}"
)
endif()
add_custom_command(