From aca2d630ce831eb3482329daa881cd3c699d9f30 Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Wed, 1 Sep 2021 10:06:21 +0100 Subject: [PATCH] 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 --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 18a926ccb5..9536ccf0f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,7 @@ if(${CMAKE_CROSSCOMPILING}) target_compile_definitions(mbed-core INTERFACE + TARGET_NAME=${MBED_TARGET} ${MBED_TARGET_DEFINITIONS} ${MBED_CONFIG_DEFINITIONS} )