diff --git a/CMakeLists.txt b/CMakeLists.txt index d2a93addf7..99c469de75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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(