Skip to content

Commit 3579bb6

Browse files
committed
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.
1 parent 76b2902 commit 3579bb6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ function(mbed_generate_bin_hex target)
171171
)
172172

173173
if(TARGET mbed-post-build-bin-${MBED_TARGET})
174+
# Remove the .elf file to force regenerate the application binaries
175+
# (including .bin and .hex). This ensures that the post-build script runs
176+
# on a raw application instead of a previous build that already went
177+
# through the post-build process once.
178+
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${target}.elf)
179+
174180
# The artefacts must be created before they can be further manipulated
175181
add_dependencies(mbed-post-build-bin-${MBED_TARGET} ${target})
176182

0 commit comments

Comments
 (0)