CMake: Fix third party toolchain file suppport

Compile defintions are always included. However, functions that set compile options
are only called if a third party toolchain file is not used
pull/13566/head
Hugues Kamba 2020-10-28 16:53:46 +00:00
parent 0bf4683f46
commit 66f65c0e89
2 changed files with 23 additions and 12 deletions

View File

@ -12,16 +12,15 @@ endif()
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
include(${MBED_PATH}/tools/cmake/core.cmake)
include(${MBED_PATH}/tools/cmake/profile.cmake)
add_library(mbed-core INTERFACE)
add_library(mbed-os INTERFACE)
target_link_libraries(mbed-os
INTERFACE
mbed-rtos
mbed-core
INTERFACE
mbed-rtos
mbed-core
)
add_library(mbed-baremetal INTERFACE)
@ -59,14 +58,18 @@ if(NOT ${MBED_PRINTF_LIB} IN_LIST MBED_PRINTF_LIB_TYPES)
)
endif()
mbed_set_cpu_core_options(mbed-core ${MBED_TOOLCHAIN})
mbed_set_toolchain_options(mbed-core)
mbed_set_c_lib(mbed-core ${MBED_C_LIB})
mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB})
mbed_set_profile_options(mbed-core ${MBED_TOOLCHAIN})
mbed_set_cpu_core_definitions(mbed-core)
if(${MBED_TOOLCHAIN_FILE_USED})
mbed_set_cpu_core_options(mbed-core ${MBED_TOOLCHAIN})
mbed_set_toolchain_options(mbed-core)
mbed_set_profile_options(mbed-core ${MBED_TOOLCHAIN})
mbed_set_c_lib(mbed-core ${MBED_C_LIB})
mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB})
endif()
set(MBED_TARGET_LABELS
${MBED_TARGET_LABELS} CACHE INTERNAL ""
${MBED_TARGET_LABELS} CACHE INTERNAL ""
)
target_compile_definitions(mbed-core

View File

@ -9,11 +9,19 @@ endif()
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
set(MBED_TOOLCHAIN_FILE_USED FALSE)
# Set default toolchain file
if(NOT CMAKE_TOOLCHAIN_FILE)
set(MBED_TOOLCHAIN_FILE_USED TRUE)
set(CMAKE_TOOLCHAIN_FILE "${MBED_PATH}/tools/cmake/toolchain.cmake" CACHE INTERNAL "")
# Specify locations for toolchains and generic options
include(${MBED_PATH}/tools/cmake/toolchains/${MBED_TOOLCHAIN}.cmake)
# Specify available build profiles and add options for the selected build profile
include(${MBED_PATH}/tools/cmake/profile.cmake)
endif()
# Toolchain setup
include(${MBED_PATH}/tools/cmake/toolchains/${MBED_TOOLCHAIN}.cmake)
enable_language(C CXX ASM)