Force regenerate application binaries on rebuild

If a target has a post binary hook, we should force regenerate
the application binaries every time so that the hook is run on a
raw binary rather than a previous build that already went through
the post-build process once.
pull/14378/head
Lingkai Dong 2021-03-03 18:11:45 +00:00
parent 76b2902f48
commit 3579bb65da
1 changed files with 6 additions and 0 deletions

View File

@ -171,6 +171,12 @@ function(mbed_generate_bin_hex target)
)
if(TARGET mbed-post-build-bin-${MBED_TARGET})
# Remove the .elf file to force regenerate the application binaries
# (including .bin and .hex). This ensures that the post-build script runs
# on a raw application instead of a previous build that already went
# through the post-build process once.
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${target}.elf)
# The artefacts must be created before they can be further manipulated
add_dependencies(mbed-post-build-bin-${MBED_TARGET} ${target})