Skip to content

Commit

Permalink
CMake: pass predefined macros to ARM toolchain linker
Browse files Browse the repository at this point in the history
  • Loading branch information
LDong-Arm committed Nov 19, 2020
1 parent 80a0a5b commit 9bf6aff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Expand Up @@ -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
Expand All @@ -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(
Expand Down

0 comments on commit 9bf6aff

Please sign in to comment.