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)
10
10
cmake_policy (SET CMP0076 NEW )
11
11
endif ()
12
12
13
+ include (${MBED_CONFIG_PATH} /mbed_config.cmake )
13
14
include (${MBED_PATH} /tools/cmake/core.cmake )
14
15
include (${MBED_PATH} /tools/cmake/profile.cmake )
15
16
@@ -74,6 +75,22 @@ target_compile_definitions(mbed-core
74
75
${MBED_CONFIG_DEFINITIONS}
75
76
)
76
77
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
+
77
94
# Include mbed.h and config from generate folder
78
95
target_include_directories (mbed-core
79
96
INTERFACE
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ if(MBEDIDE)
13
13
set_property (GLOBAL PROPERTY MBED_STUDIO_ARM_COMPILER "--ide=mbed" )
14
14
endif ()
15
15
16
-
17
16
# Sets toolchain options
18
17
function (mbed_set_toolchain_options target )
19
18
get_property (mbed_studio_arm_compiler GLOBAL PROPERTY MBED_STUDIO_ARM_COMPILER )
@@ -48,11 +47,6 @@ function(mbed_set_toolchain_options target)
48
47
$< $< COMPILE_LANGUAGE:ASM> :${MBED_STUDIO_ARM_COMPILER} >
49
48
)
50
49
51
- target_compile_definitions (${target}
52
- INTERFACE
53
- TOOLCHAIN_ARM
54
- )
55
-
56
50
list (APPEND link_options
57
51
"${MBED_STUDIO_ARM_COMPILER} "
58
52
"--map"
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
7
7
set (GCC_ELF2BIN "arm-none-eabi-objcopy" )
8
8
set_property (GLOBAL PROPERTY ELF2BIN ${GCC_ELF2BIN} )
9
9
10
-
11
10
# Sets toolchain options
12
11
function (mbed_set_toolchain_options target )
13
12
list (APPEND link_options
@@ -52,13 +51,6 @@ function(mbed_set_toolchain_options target)
52
51
${common_options}
53
52
)
54
53
55
- target_compile_definitions (${target}
56
- INTERFACE
57
- TOOLCHAIN_GCC_ARM
58
- TOOLCHAIN_GCC
59
- )
60
-
61
-
62
54
target_link_options (${target}
63
55
INTERFACE
64
56
${common_options}
You can’t perform that action at this time.
0 commit comments