From 39ab9c8b9931d2ed1d2063ca6646e430f0c23cfe Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Tue, 9 Feb 2021 15:17:31 +0000 Subject: [PATCH] CMake: add naming convention for mbed targets Using lowercase with dashes for targets with mbed- prefix --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aef5509bd1..8366e416a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,9 +128,14 @@ add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL) # preventing CMake from working its usage requirements magic and forcing us to set the linker # script globally. # +# keep cmake naming convention in targets, using lowercase with dashes +string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED) +string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED}) +string(PREPEND MBED_TARGET_CONVERTED "mbed-") + # TODO: Remove when all MBED_TARGETS have been converted to build system targets. -if(TARGET ${MBED_TARGET}) - target_link_libraries(mbed-core INTERFACE ${MBED_TARGET}) +if(TARGET ${MBED_TARGET_CONVERTED}) + target_link_libraries(mbed-core INTERFACE ${MBED_TARGET_CONVERTED}) else() get_property(LINKER_SCRIPT GLOBAL PROPERTY MBED_TARGET_LINKER_FILE) mbed_set_linker_script(mbed-core ${LINKER_SCRIPT})