CMake: mbed target converted is cached variable

pull/14427/head
Martin Kojtal 2021-02-23 08:26:44 +00:00
parent f0d67431ff
commit 3d36e28307
3 changed files with 7 additions and 15 deletions

View File

@ -8,6 +8,12 @@ cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
include(tools/cmake/set_linker_script.cmake)
# Ensure the words that make up the Mbed target name are separated with a hyphen, lowercase, and with the `mbed-` prefix.
set(MBED_TARGET_CONVERTED "" CACHE STRING "" FORCE)
string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED)
string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED})
string(PREPEND MBED_TARGET_CONVERTED "mbed-")
add_library(mbed-core INTERFACE)
add_library(mbed-core-obj OBJECT)
@ -23,6 +29,7 @@ target_link_libraries(mbed-os
INTERFACE
mbed-rtos
mbed-core
${MBED_TARGET_CONVERTED}
)
add_library(mbed-baremetal INTERFACE)
@ -147,11 +154,6 @@ add_subdirectory(features EXCLUDE_FROM_ALL)
add_subdirectory(cmsis/CMSIS_5/CMSIS/RTOS2 EXCLUDE_FROM_ALL)
add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL)
# Ensure the words that make up the Mbed target name are separated with a hyphen, lowercase, and with the `mbed-` prefix.
string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED)
string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED})
string(PREPEND MBED_TARGET_CONVERTED "mbed-")
target_link_libraries(mbed-core-obj PRIVATE ${MBED_TARGET_CONVERTED})
#

View File

@ -31,9 +31,4 @@ target_compile_definitions(mbed-rtos
MBED_CONF_RTOS_PRESENT=1
)
# Ensure the words that make up the Mbed target name are separated with a hyphen, lowercase, and with the `mbed-` prefix.
string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED)
string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED})
string(PREPEND MBED_TARGET_CONVERTED "mbed-")
target_link_libraries(mbed-rtos-obj PRIVATE mbed-core ${MBED_TARGET_CONVERTED})

View File

@ -32,9 +32,4 @@ foreach(options COMPILE_DEFINITIONS COMPILE_FEATURES COMPILE_OPTIONS INCLUDE_DIR
set_target_properties(mbed-events-obj PROPERTIES ${options} $<TARGET_PROPERTY:mbed-events,INTERFACE_${options}>)
endforeach()
# Ensure the words that make up the Mbed target name are separated with a hyphen, lowercase, and with the `mbed-` prefix.
string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED)
string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED})
string(PREPEND MBED_TARGET_CONVERTED "mbed-")
target_link_libraries(mbed-events-obj PRIVATE mbed-core ${MBED_TARGET_CONVERTED})