File tree Expand file tree Collapse file tree 5 files changed +37
-23
lines changed Expand file tree Collapse file tree 5 files changed +37
-23
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,11 @@ include(${MBED_CONFIG_PATH}/mbed_config.cmake)
21
21
include (${MBED_ROOT} /cmake/core.cmake )
22
22
mbed_set_cpu_core_options (mbed-os ${MBED_TOOLCHAIN} )
23
23
24
- set (CMAKE_TOOLCHAIN_FILE "${MBED_ROOT} /cmake/toolchain.cmake" CACHE INTERNAL "" )
24
+ # Set the toolchain file, do not include it as it's included by CMake on system level
25
+ if (NOT CMAKE_TOOLCHAIN_FILE )
26
+ set (CMAKE_TOOLCHAIN_FILE "${MBED_ROOT} /cmake/toolchain.cmake" CACHE INTERNAL "" )
27
+ endif ()
28
+
25
29
include (${MBED_ROOT} /cmake/toolchains/${MBED_TOOLCHAIN}.cmake )
26
30
enable_language (C CXX ASM )
27
31
mbed_set_toolchain_options (mbed-os )
Original file line number Diff line number Diff line change @@ -40,11 +40,6 @@ elseif (MBED_CPU_CORE STREQUAL Cortex-M7FD)
40
40
set (CMAKE_SYSTEM_PROCESSOR cortex-m7 )
41
41
endif ()
42
42
43
- #include(${MBED_ROOT}/cmake/toolchains/${MBED_TOOLCHAIN}.cmake)
44
-
45
- # Project setup
46
- #enable_language(C CXX ASM)
47
-
48
43
# Clear toolchains options for all languages as Mbed OS uses
49
44
# different initialisation options (such as for optimization and debug symbols)
50
45
set (CMAKE_C_FLAGS_DEBUG "" CACHE STRING "" FORCE )
Original file line number Diff line number Diff line change @@ -19,6 +19,22 @@ if(MBEDIDE)
19
19
set_property (GLOBAL PROPERTY MBED_STUDIO_ARM_COMPILER "--ide=mbed" )
20
20
endif ()
21
21
22
+ # Set the language standard to use per target
23
+ function (mbed_set_language_standard target )
24
+ set_target_properties (${target}
25
+ PROPERTIES
26
+ C_STANDARD 11
27
+ C_STANDARD_REQUIRED YES
28
+ C_EXTENSIONS YES
29
+ )
30
+
31
+ set_target_properties (${target}
32
+ PROPERTIES
33
+ CXX_STANDARD 14
34
+ CXX_STANDARD_REQUIRED YES
35
+ CXX_EXTENSIONS YES
36
+ )
37
+ endfunction ()
22
38
23
39
# Sets toolchain options
24
40
function (mbed_set_toolchain_options target )
Original file line number Diff line number Diff line change @@ -13,6 +13,22 @@ set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
13
13
set (GCC_ELF2BIN "arm-none-eabi-objcopy" )
14
14
set_property (GLOBAL PROPERTY ELF2BIN ${GCC_ELF2BIN} )
15
15
16
+ # Set the language standard to use per target
17
+ function (mbed_set_language_standard target )
18
+ set_target_properties (${target}
19
+ PROPERTIES
20
+ C_STANDARD 11
21
+ C_STANDARD_REQUIRED YES
22
+ C_EXTENSIONS YES
23
+ )
24
+
25
+ set_target_properties (${target}
26
+ PROPERTIES
27
+ CXX_STANDARD 14
28
+ CXX_STANDARD_REQUIRED YES
29
+ CXX_EXTENSIONS YES
30
+ )
31
+ endfunction ()
16
32
17
33
# Sets toolchain options
18
34
function (mbed_set_toolchain_options target )
Original file line number Diff line number Diff line change @@ -15,20 +15,3 @@ function(mbed_add_cmake_directory_if_labels PREFIX)
15
15
endif ()
16
16
endforeach ()
17
17
endfunction ()
18
-
19
- # Set the language standard to use per target
20
- function (mbed_set_language_standard target )
21
- set_target_properties (${target}
22
- PROPERTIES
23
- C_STANDARD 11
24
- C_STANDARD_REQUIRED YES
25
- C_EXTENSIONS YES
26
- )
27
-
28
- set_target_properties (${target}
29
- PROPERTIES
30
- CXX_STANDARD 14
31
- CXX_STANDARD_REQUIRED YES
32
- CXX_EXTENSIONS YES
33
- )
34
- endfunction ()
You can’t perform that action at this time.
0 commit comments