From ad27a3ec6993f474ab96e373874f12e6577be6be Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Wed, 3 Mar 2021 18:26:11 +0000 Subject: [PATCH] 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 * `$` to query a property at run time --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5857f3d94..ad61efd96b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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})