CMake: pass application name to post-build hook

Pass the exact name to the post-build hook, when an application's
or test's `CMakeLists.txt` calls `mbed_set_post_build()`. The
interface is CMake's built-in mechanism:
* `set_target_properties()` to set a property, e.g. application name
* `$<TARGET_PROPERTY:target,property>` to query a property at run time
pull/14378/head
Lingkai Dong 2021-03-03 18:26:11 +00:00
parent 3579bb65da
commit ad27a3ec69
1 changed files with 6 additions and 0 deletions

View File

@ -177,6 +177,12 @@ function(mbed_generate_bin_hex target)
# through the post-build process once.
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${target}.elf)
# Pass the application's name to the Mbed target's post build operation
set_target_properties(mbed-post-build-bin-${MBED_TARGET}
PROPERTIES
application ${target}
)
# The artefacts must be created before they can be further manipulated
add_dependencies(mbed-post-build-bin-${MBED_TARGET} ${target})