Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,13 @@ function(mbed_generate_bin_hex target)
)

if(TARGET mbed-post-build-bin-${MBED_TARGET})
add_custom_target(mbed-post-build
ALL
DEPENDS
mbed-post-build-bin-${MBED_TARGET}
)
# The artefacts must be created before they can be further manipulated
add_dependencies(mbed-post-build-bin-${MBED_TARGET} ${target})

# Add a post-build hook to the top-level CMake target in the form of a
# CMake custom target. The hook depends on Mbed target specific
# post-build CMake target which has a custom command attached to it.
add_custom_target(mbed-post-build ALL DEPENDS mbed-post-build-bin-${MBED_TARGET})
endif()
endfunction()

Expand Down
11 changes: 3 additions & 8 deletions tools/cmake/mbed_set_post_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@
#
macro(mbed_set_post_build_operation)

add_custom_target(mbed-post-build-bin-${mbed_target_name}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${APP_TARGET}.bin
)

# Ensures the application artefacts are created before manipulating them.
add_dependencies(mbed-post-build-bin-${mbed_target_name} ${APP_TARGET})
add_custom_target(mbed-post-build-bin-${mbed_target_name})

add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/${APP_TARGET}.bin
TARGET
mbed-post-build-bin-${mbed_target_name}
POST_BUILD
COMMAND
${post_build_command}
Expand Down