CMake: Set TARGET_NAME macro

The C/C++ macro `TARGET_NAME` allows code to print the current
target's name, e.g. in error reporting when a fault happens. This
macro is exported by Mbed CLI 1 and used by mbed_error.c, so for
compatibility we let CMake set the same name of macro.

Fixes ARMmbed/mbed-tools#313
pull/15041/head
Lingkai Dong 2021-09-01 10:06:21 +01:00
parent be31d50cc4
commit aca2d630ce
1 changed files with 1 additions and 0 deletions

View File

@ -101,6 +101,7 @@ if(${CMAKE_CROSSCOMPILING})
target_compile_definitions(mbed-core
INTERFACE
TARGET_NAME=${MBED_TARGET}
${MBED_TARGET_DEFINITIONS}
${MBED_CONFIG_DEFINITIONS}
)