CMake: add naming convention for mbed targets

Using lowercase with dashes for targets with mbed- prefix
pull/14255/head
Martin Kojtal 2021-02-09 15:17:31 +00:00
parent ce6ff0ac5f
commit 39ab9c8b99
1 changed files with 7 additions and 2 deletions

View File

@ -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 # preventing CMake from working its usage requirements magic and forcing us to set the linker
# script globally. # 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. # TODO: Remove when all MBED_TARGETS have been converted to build system targets.
if(TARGET ${MBED_TARGET}) if(TARGET ${MBED_TARGET_CONVERTED})
target_link_libraries(mbed-core INTERFACE ${MBED_TARGET}) target_link_libraries(mbed-core INTERFACE ${MBED_TARGET_CONVERTED})
else() else()
get_property(LINKER_SCRIPT GLOBAL PROPERTY MBED_TARGET_LINKER_FILE) get_property(LINKER_SCRIPT GLOBAL PROPERTY MBED_TARGET_LINKER_FILE)
mbed_set_linker_script(mbed-core ${LINKER_SCRIPT}) mbed_set_linker_script(mbed-core ${LINKER_SCRIPT})