Skip to content

Commit 4236db4

Browse files
authored
Merge pull request #14255 from 0xc0170/cmake-fix-naming-targets
CMake: fix naming targets
2 parents aa561ee + fdef59f commit 4236db4

File tree

175 files changed

+783
-754
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+783
-754
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+
# Ensure the words that make up the Mbed target name are separated with a hyphen, lowercase, and with the `mbed-` prefix.
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})

targets/TARGET_STM/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ add_subdirectory(TARGET_STM32L5 EXCLUDE_FROM_ALL)
1717
add_subdirectory(TARGET_STM32WB EXCLUDE_FROM_ALL)
1818
add_subdirectory(TARGET_STM32WL EXCLUDE_FROM_ALL)
1919

20-
add_library(STM INTERFACE)
20+
add_library(mbed-stm INTERFACE)
2121

22-
target_include_directories(STM
22+
target_include_directories(mbed-stm
2323
INTERFACE
2424
.
2525
)
2626

27-
target_sources(STM
27+
target_sources(mbed-stm
2828
INTERFACE
2929
USBPhy_STM32.cpp
3030
analogin_api.c

targets/TARGET_STM/TARGET_STM32F0/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ add_subdirectory(TARGET_STM32F070xB EXCLUDE_FROM_ALL)
77
add_subdirectory(TARGET_STM32F030x8 EXCLUDE_FROM_ALL)
88
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)
99

10-
add_library(STM32F0 INTERFACE)
10+
add_library(mbed-stm32f0 INTERFACE)
1111

12-
target_include_directories(STM32F0
12+
target_include_directories(mbed-stm32f0
1313
INTERFACE
1414
.
1515
)
1616

17-
target_sources(STM32F0
17+
target_sources(mbed-stm32f0
1818
INTERFACE
1919
analogin_device.c
2020
analogout_device.c
@@ -26,4 +26,4 @@ target_sources(STM32F0
2626
spi_api.c
2727
)
2828

29-
target_link_libraries(STM32F0 INTERFACE STM STM32F0Cube_FW)
29+
target_link_libraries(mbed-stm32f0 INTERFACE mbed-stm mbed-stm32f0cube-fw)

targets/TARGET_STM/TARGET_STM32F0/STM32Cube_FW/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
add_library(STM32F0Cube_FW INTERFACE)
4+
add_library(mbed-stm32f0cube-fw INTERFACE)
55

6-
target_sources(STM32F0Cube_FW
6+
target_sources(mbed-stm32f0cube-fw
77
INTERFACE
88
STM32F0xx_HAL_Driver/Legacy/stm32f0xx_hal_can_legacy.c
99
STM32F0xx_HAL_Driver/stm32f0xx_hal.c
@@ -68,7 +68,7 @@ target_sources(STM32F0Cube_FW
6868
system_stm32f0xx.c
6969
)
7070

71-
target_include_directories(STM32F0Cube_FW
71+
target_include_directories(mbed-stm32f0cube-fw
7272
INTERFACE
7373
.
7474
CMSIS

targets/TARGET_STM/TARGET_STM32F0/TARGET_STM32F030x8/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
99
set(LINKER_FILE TOOLCHAIN_ARM/stm32f030x8.sct)
1010
endif()
1111

12-
add_library(STM32F030x8 INTERFACE)
12+
add_library(mbed-stm32f030x8 INTERFACE)
1313

14-
target_sources(STM32F030x8
14+
target_sources(mbed-stm32f030x8
1515
INTERFACE
1616
${STARTUP_FILE}
1717
)
1818

19-
target_include_directories(STM32F030x8
19+
target_include_directories(mbed-stm32f030x8
2020
INTERFACE
2121
.
2222
)
2323

24-
mbed_set_linker_script(STM32F030x8 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
24+
mbed_set_linker_script(mbed-stm32f030x8 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
2525

26-
target_link_libraries(STM32F030x8 INTERFACE STM32F0)
26+
target_link_libraries(mbed-stm32f030x8 INTERFACE mbed-stm32f0)

targets/TARGET_STM/TARGET_STM32F0/TARGET_STM32F070xB/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
1111
set(LINKER_FILE TOOLCHAIN_ARM/stm32f070xb.sct)
1212
endif()
1313

14-
add_library(STM32F070xB INTERFACE)
14+
add_library(mbed-stm32f070xb INTERFACE)
1515

16-
target_sources(STM32F070xB
16+
target_sources(mbed-stm32f070xb
1717
INTERFACE
1818
system_clock.c
1919
${STARTUP_FILE}
2020
)
2121

22-
target_include_directories(STM32F070xB
22+
target_include_directories(mbed-stm32f070xb
2323
INTERFACE
2424
.
2525
)
2626

27-
mbed_set_linker_script(STM32F070xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
27+
mbed_set_linker_script(mbed-stm32f070xb ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
2828

29-
target_link_libraries(STM32F070xB INTERFACE STM32F0)
29+
target_link_libraries(mbed-stm32f070xb INTERFACE mbed-stm32f0)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
add_library(NUCLEO_F070RB INTERFACE)
4+
add_library(mbed-nucleo-f070rb INTERFACE)
55

6-
target_sources(NUCLEO_F070RB
6+
target_sources(mbed-nucleo-f070rb
77
INTERFACE
88
PeripheralPins.c
99
)
1010

11-
target_include_directories(NUCLEO_F070RB
11+
target_include_directories(mbed-nucleo-f070rb
1212
INTERFACE
1313
.
1414
)
1515

16-
target_link_libraries(NUCLEO_F070RB INTERFACE STM32F070xB)
16+
target_link_libraries(mbed-nucleo-f070rb INTERFACE mbed-stm32f070xb)

targets/TARGET_STM/TARGET_STM32F0/TARGET_STM32F072xB/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
1111
set(LINKER_FILE TOOLCHAIN_ARM/stm32f072xb.sct)
1212
endif()
1313

14-
add_library(STM32F072xB INTERFACE)
14+
add_library(mbed-stm32f072xB INTERFACE)
1515

16-
target_sources(STM32F072xB
16+
target_sources(mbed-stm32f072xB
1717
INTERFACE
1818
system_clock.c
1919
${STARTUP_FILE}
2020
)
2121

22-
target_include_directories(STM32F072xB
22+
target_include_directories(mbed-stm32f072xB
2323
INTERFACE
2424
.
2525
)
2626

27-
mbed_set_linker_script(STM32F072xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
27+
mbed_set_linker_script(mbed-stm32f072xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
2828

29-
target_link_libraries(STM32F072xB INTERFACE STM32F0)
29+
target_link_libraries(mbed-stm32f072xB INTERFACE mbed-stm32f0)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
add_library(NUCLEO_F072RB INTERFACE)
4+
add_library(mbed-nucleo-f072rb INTERFACE)
55

6-
target_sources(NUCLEO_F072RB
6+
target_sources(mbed-nucleo-f072rb
77
INTERFACE
88
PeripheralPins.c
99
)
1010

11-
target_include_directories(NUCLEO_F072RB
11+
target_include_directories(mbed-nucleo-f072rb
1212
INTERFACE
1313
.
1414
)
1515

16-
target_link_libraries(NUCLEO_F072RB INTERFACE STM32F072xB)
16+
target_link_libraries(mbed-nucleo-f072rb INTERFACE mbed-stm32f072xb)

targets/TARGET_STM/TARGET_STM32F0/TARGET_STM32F091xC/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
1111
set(LINKER_FILE TOOLCHAIN_ARM/stm32f091xc.sct)
1212
endif()
1313

14-
add_library(STM32F091xC INTERFACE)
14+
add_library(mbed-stm32f091xc INTERFACE)
1515

16-
target_sources(STM32F091xC
16+
target_sources(mbed-stm32f091xc
1717
INTERFACE
1818
system_clock.c
1919
${STARTUP_FILE}
2020
)
2121

22-
target_include_directories(STM32F091xC
22+
target_include_directories(mbed-stm32f091xc
2323
INTERFACE
2424
.
2525
)
2626

27-
mbed_set_linker_script(STM32F091xC ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
27+
mbed_set_linker_script(mbed-stm32f091xc ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
2828

29-
target_link_libraries(STM32F091xC INTERFACE STM32F0)
29+
target_link_libraries(mbed-stm32f091xc INTERFACE mbed-stm32f0)

0 commit comments

Comments
 (0)