mirror of https://github.com/ARMmbed/mbed-os.git
CMake: use CMAKE_TOOLCHAIN_FILE
We should define CMAKE_TOOLCHAIN_FILE (as we are providing Mbed OS toolchain file). This fixes also the issue we had with Unix makefiles where application would be without response files. For more details, see https://gitlab.kitware.com/cmake/cmake/-/issues/21104 As the Mbed OS toolchain file is included by CMake, we need to have enabling language in the main CMake (can be executed only once).pull/13566/head
parent
44f9d176e8
commit
8aa4a85b35
|
@ -10,23 +10,29 @@ if(POLICY CMP0076)
|
||||||
cmake_policy(SET CMP0076 NEW)
|
cmake_policy(SET CMP0076 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
|
||||||
|
|
||||||
|
# Set default toolchain file
|
||||||
|
if(NOT CMAKE_TOOLCHAIN_FILE)
|
||||||
|
set(CMAKE_TOOLCHAIN_FILE "${MBED_ROOT}/cmake/toolchain.cmake" CACHE INTERNAL "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Toolchain setup
|
||||||
|
include(${MBED_ROOT}/cmake/toolchains/${MBED_TOOLCHAIN}.cmake)
|
||||||
|
enable_language(C CXX ASM)
|
||||||
|
|
||||||
|
include(${MBED_ROOT}/cmake/core.cmake)
|
||||||
|
include(${MBED_ROOT}/cmake/util.cmake)
|
||||||
|
include(${MBED_ROOT}/cmake/profile.cmake)
|
||||||
|
|
||||||
# Create Mbed OS library
|
# Create Mbed OS library
|
||||||
add_library(mbed-os OBJECT)
|
add_library(mbed-os OBJECT)
|
||||||
|
|
||||||
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
|
|
||||||
|
|
||||||
include(${MBED_ROOT}/cmake/core.cmake)
|
|
||||||
mbed_set_cpu_core_options(mbed-os ${MBED_TOOLCHAIN})
|
mbed_set_cpu_core_options(mbed-os ${MBED_TOOLCHAIN})
|
||||||
|
|
||||||
include(${MBED_ROOT}/cmake/toolchain.cmake)
|
|
||||||
mbed_set_toolchain_options(mbed-os)
|
mbed_set_toolchain_options(mbed-os)
|
||||||
mbed_set_language_standard(mbed-os)
|
mbed_set_language_standard(mbed-os)
|
||||||
|
|
||||||
include(${MBED_ROOT}/cmake/profile.cmake)
|
|
||||||
mbed_set_profile_options(mbed-os ${MBED_TOOLCHAIN})
|
mbed_set_profile_options(mbed-os ${MBED_TOOLCHAIN})
|
||||||
|
|
||||||
include(${MBED_ROOT}/cmake/util.cmake)
|
|
||||||
|
|
||||||
set_target_properties(mbed-os
|
set_target_properties(mbed-os
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
MBED_TARGET_LABELS "${MBED_TARGET_LABELS}"
|
MBED_TARGET_LABELS "${MBED_TARGET_LABELS}"
|
||||||
|
|
|
@ -40,19 +40,12 @@ elseif (MBED_CPU_CORE STREQUAL Cortex-M7FD)
|
||||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m7)
|
set(CMAKE_SYSTEM_PROCESSOR cortex-m7)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include(${MBED_ROOT}/cmake/toolchains/${MBED_TOOLCHAIN}.cmake)
|
|
||||||
|
|
||||||
# Compiler setup
|
# Compiler setup
|
||||||
set(CMAKE_SYSTEM_NAME Generic)
|
set(CMAKE_SYSTEM_NAME Generic)
|
||||||
set(CMAKE_CROSSCOMPILING TRUE)
|
set(CMAKE_CROSSCOMPILING TRUE)
|
||||||
set(CMAKE_C_COMPILER_WORKS TRUE)
|
set(CMAKE_C_COMPILER_WORKS TRUE)
|
||||||
set(CMAKE_CXX_COMPILER_WORKS TRUE)
|
set(CMAKE_CXX_COMPILER_WORKS TRUE)
|
||||||
|
|
||||||
# Project setup
|
|
||||||
enable_language(C CXX ASM)
|
|
||||||
|
|
||||||
# Set the language standard to use per target
|
# Set the language standard to use per target
|
||||||
function(mbed_set_language_standard target)
|
function(mbed_set_language_standard target)
|
||||||
set_target_properties(${target}
|
set_target_properties(${target}
|
||||||
|
|
Loading…
Reference in New Issue