Skip to content

Commit 39ab9c8

Browse files
committed
CMake: add naming convention for mbed targets
Using lowercase with dashes for targets with mbed- prefix
1 parent ce6ff0a commit 39ab9c8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,14 @@ add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL)
128128
# preventing CMake from working its usage requirements magic and forcing us to set the linker
129129
# script globally.
130130
#
131+
# keep cmake naming convention in targets, using lowercase with dashes
132+
string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED)
133+
string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED})
134+
string(PREPEND MBED_TARGET_CONVERTED "mbed-")
135+
131136
# TODO: Remove when all MBED_TARGETS have been converted to build system targets.
132-
if(TARGET ${MBED_TARGET})
133-
target_link_libraries(mbed-core INTERFACE ${MBED_TARGET})
137+
if(TARGET ${MBED_TARGET_CONVERTED})
138+
target_link_libraries(mbed-core INTERFACE ${MBED_TARGET_CONVERTED})
134139
else()
135140
get_property(LINKER_SCRIPT GLOBAL PROPERTY MBED_TARGET_LINKER_FILE)
136141
mbed_set_linker_script(mbed-core ${LINKER_SCRIPT})

0 commit comments

Comments
 (0)