mbed-os/targets/TARGET_NXP
Lingkai Dong 351680fb18 Rework post-build to support multiple executables
When building greentea tests, each test is an executable with its
own output binary path. This is also the case when a user project
produces multiple executables. But the current implementation of
post-build operations always assumes there's only one executable,
at the root of the build directory.

The post-build command depends on Mbed target, and it always takes
the the executable we build as an input file. To achieve this, we
let each Mbed target (that has a post-build command) define a function

    function(mbed_post_build_function target)

which takes a CMake executable target as an argument from which it can
get its binary path using generator expressions. It generates and adds
to the passed executable target a post-build custom command.

Notes:
* The function name needs to be exact, because CMake only supports
literal function calls - CMake can't dereference a function name from
a variable. To avoid multiple definitions of this function, each Mbed
target needs to guard it with a macro to check if the user is
building this Mbed target.
* `mbed_post_build_function()` is a function, but it is usually
defined by another macro rather than a parent function, because
nesting functions would make many variables inaccessible inside the
innermost `mbed_post_build_function()`.
* There's no more need to force regenerate images. Previously, post-
build commands were custom *targets* which always got to run, so we
force regenerated images on every build to avoid patching an image
that's already been patched once on previous build. Now post-build
commands are custom *commands* of the same executable target, and they
are only run if the executable target itself is rebuilt.
2021-07-22 17:31:22 +01:00
..
TARGET_LPC11XX_11CXX Merge pull request #14516 from 0xc0170/fix-cmake-project-name 2021-04-15 14:00:21 +02:00
TARGET_LPC176X CMake targets: remove MBED_PATH, use stadard variables 2021-04-14 13:09:26 +01:00
TARGET_MCUXpresso_MCUS Merge pull request #14623 from s-bruce13/master 2021-05-13 11:18:05 +01:00
scripts Rework post-build to support multiple executables 2021-07-22 17:31:22 +01:00
CMakeLists.txt CMake: set CMAKE_MODULE_PATH in the Mbed OS CMakelists.txt 2021-04-14 13:09:28 +01:00
USBEndpoints_LPC17_LPC23.h Add SPDX license identifier to Arm files 2020-10-15 10:47:27 +01:00
USBHAL_LPC17.cpp Add SPDX license identifier to Arm files 2020-10-15 10:47:27 +01:00
USBPhyHw.h Add SPDX license identifier to Arm files 2020-10-15 10:47:27 +01:00
mbed_rtx.h Add SPDX license identifier to Arm files 2020-10-15 10:47:27 +01:00