File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed
Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ if(POLICY CMP0076)
1010 cmake_policy (SET CMP0076 NEW)
1111endif ()
1212
13+ include (${MBED_CONFIG_PATH} /mbed_config.cmake)
1314include (${MBED_PATH} /tools/cmake/core.cmake)
1415include (${MBED_PATH} /tools/cmake/profile.cmake)
1516
@@ -74,6 +75,22 @@ target_compile_definitions(mbed-core
7475 ${MBED_CONFIG_DEFINITIONS}
7576)
7677
78+ # Add compile definitions for backward compatibility with the toolchain
79+ # supported. New source files should instead check for __GNUC__ and __clang__
80+ # for the GCC_ARM and ARM toolchains respectively.
81+ if (${MBED_TOOLCHAIN} STREQUAL "GCC_ARM" )
82+ target_compile_definitions (mbed-core
83+ INTERFACE
84+ TOOLCHAIN_GCC_ARM
85+ TOOLCHAIN_GCC
86+ )
87+ elseif (${MBED_TOOLCHAIN} STREQUAL "ARM" )
88+ target_compile_definitions (mbed-core
89+ INTERFACE
90+ TOOLCHAIN_ARM
91+ )
92+ endif ()
93+
7794# Include mbed.h and config from generate folder
7895target_include_directories (mbed-core
7996 INTERFACE
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ if(MBEDIDE)
1313 set_property (GLOBAL PROPERTY MBED_STUDIO_ARM_COMPILER "--ide=mbed" )
1414endif ()
1515
16-
1716# Sets toolchain options
1817function (mbed_set_toolchain_options target )
1918 get_property (mbed_studio_arm_compiler GLOBAL PROPERTY MBED_STUDIO_ARM_COMPILER)
@@ -48,11 +47,6 @@ function(mbed_set_toolchain_options target)
4847 $<$<COMPILE_LANGUAGE:ASM>:${MBED_STUDIO_ARM_COMPILER} >
4948 )
5049
51- target_compile_definitions (${target}
52- INTERFACE
53- TOOLCHAIN_ARM
54- )
55-
5650 list (APPEND link_options
5751 "${MBED_STUDIO_ARM_COMPILER} "
5852 "--map"
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
77set (GCC_ELF2BIN "arm-none-eabi-objcopy" )
88set_property (GLOBAL PROPERTY ELF2BIN ${GCC_ELF2BIN} )
99
10-
1110# Sets toolchain options
1211function (mbed_set_toolchain_options target )
1312 list (APPEND link_options
@@ -52,13 +51,6 @@ function(mbed_set_toolchain_options target)
5251 ${common_options}
5352 )
5453
55- target_compile_definitions (${target}
56- INTERFACE
57- TOOLCHAIN_GCC_ARM
58- TOOLCHAIN_GCC
59- )
60-
61-
6254 target_link_options (${target}
6355 INTERFACE
6456 ${common_options}
You can’t perform that action at this time.
0 commit comments