File tree Expand file tree Collapse file tree 5 files changed +26
-12
lines changed Expand file tree Collapse file tree 5 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ mbed_set_cpu_core_options(mbed-os ${MBED_TOOLCHAIN})
20
20
21
21
include (${MBED_ROOT} /cmake/toolchain.cmake )
22
22
mbed_set_toolchain_options (mbed-os )
23
+ mbed_set_language_standard (mbed-os )
23
24
24
25
include (${MBED_ROOT} /cmake/profile.cmake )
25
26
mbed_set_profile_options (mbed-os ${MBED_TOOLCHAIN} )
@@ -57,6 +58,13 @@ add_subdirectory(storage)
57
58
add_subdirectory (targets )
58
59
59
60
61
+ #
62
+ # Configures the application
63
+ #
64
+ function (mbed_os_configure_app_target target )
65
+ mbed_set_language_standard (${target} )
66
+ endfunction ()
67
+
60
68
#
61
69
# Specifies linker script used for linking `target`.
62
70
#
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ function(mbed_set_profile_options target mbed_toolchain)
8
8
if (${mbed_toolchain} STREQUAL "GCC_ARM" )
9
9
list (APPEND c_compile_options
10
10
"-c"
11
- "-std=gnu11"
12
11
"-Og"
13
12
)
14
13
target_compile_options (${target}
@@ -18,7 +17,6 @@ function(mbed_set_profile_options target mbed_toolchain)
18
17
19
18
list (APPEND cxx_compile_options
20
19
"-c"
21
- "-std=gnu++14"
22
20
"-fno-rtti"
23
21
"-Wvla"
24
22
"-Og"
@@ -51,7 +49,6 @@ function(mbed_set_profile_options target mbed_toolchain)
51
49
)
52
50
elseif (${mbed_toolchain} STREQUAL "ARM" )
53
51
list (APPEND c_compile_options
54
- "-std=gnu11"
55
52
"-O1"
56
53
)
57
54
target_compile_options (${target}
@@ -60,7 +57,6 @@ function(mbed_set_profile_options target mbed_toolchain)
60
57
)
61
58
62
59
list (APPEND cxx_compile_options
63
- "-std=gnu++14"
64
60
"-fno-rtti"
65
61
"-fno-c++-static-destructors"
66
62
"-O1"
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ function(mbed_set_profile_options target mbed_toolchain)
8
8
if (${mbed_toolchain} STREQUAL "GCC_ARM" )
9
9
list (APPEND c_compile_options
10
10
"-c"
11
- "-std=gnu11"
12
11
"-Os"
13
12
)
14
13
target_compile_options (${target}
@@ -17,7 +16,6 @@ function(mbed_set_profile_options target mbed_toolchain)
17
16
)
18
17
19
18
list (APPEND cxx_compile_options
20
- "-std=gnu++14"
21
19
"-fno-rtti"
22
20
"-Wvla"
23
21
"-Os"
@@ -49,7 +47,6 @@ function(mbed_set_profile_options target mbed_toolchain)
49
47
)
50
48
elseif (${mbed_toolchain} STREQUAL "ARM" )
51
49
list (APPEND c_compile_options
52
- "-std=gnu11"
53
50
"-Os"
54
51
)
55
52
target_compile_options (${target}
@@ -58,7 +55,6 @@ function(mbed_set_profile_options target mbed_toolchain)
58
55
)
59
56
60
57
list (APPEND cxx_compile_options
61
- "-std=gnu++14"
62
58
"-fno-rtti"
63
59
"-fno-c++-static-destructors"
64
60
"-Os"
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ function(mbed_set_profile_options target mbed_toolchain)
8
8
if (${mbed_toolchain} STREQUAL "GCC_ARM" )
9
9
list (APPEND c_compile_options
10
10
"-c"
11
- "-std=gnu11"
12
11
"-Os"
13
12
)
14
13
target_compile_options (${target}
@@ -18,7 +17,6 @@ function(mbed_set_profile_options target mbed_toolchain)
18
17
19
18
list (APPEND cxx_compile_options
20
19
"-c"
21
- "-std=gnu++14"
22
20
"-fno-rtti"
23
21
"-Wvla"
24
22
"-Os"
@@ -51,7 +49,6 @@ function(mbed_set_profile_options target mbed_toolchain)
51
49
)
52
50
elseif (${mbed_toolchain} STREQUAL "ARM" )
53
51
list (APPEND c_compile_options
54
- "-std=gnu11"
55
52
"-Oz"
56
53
)
57
54
target_compile_options (${target}
@@ -60,7 +57,6 @@ function(mbed_set_profile_options target mbed_toolchain)
60
57
)
61
58
62
59
list (APPEND cxx_compile_options
63
- "-std=gnu++14"
64
60
"-fno-rtti"
65
61
"-fno-c++-static-destructors"
66
62
"-Oz"
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ elseif (MBED_CPU_CORE STREQUAL Cortex-M7FD)
41
41
endif ()
42
42
43
43
44
+
44
45
include (${MBED_ROOT} /cmake/toolchains/${MBED_TOOLCHAIN}.cmake )
45
46
46
47
# Compiler setup
@@ -52,6 +53,23 @@ set(CMAKE_CXX_COMPILER_WORKS TRUE)
52
53
# Project setup
53
54
enable_language (C CXX ASM )
54
55
56
+ # Set the language standard to use per target
57
+ function (mbed_set_language_standard target )
58
+ set_target_properties (${target}
59
+ PROPERTIES
60
+ C_STANDARD 11
61
+ C_STANDARD_REQUIRED YES
62
+ C_EXTENSIONS YES
63
+ )
64
+
65
+ set_target_properties (${target}
66
+ PROPERTIES
67
+ CXX_STANDARD 14
68
+ CXX_STANDARD_REQUIRED YES
69
+ CXX_EXTENSIONS YES
70
+ )
71
+ endfunction ()
72
+
55
73
# Clear toolchains options for all languages as Mbed OS uses
56
74
# different initialisation options (such as for optimization and debug symbols)
57
75
set (CMAKE_C_FLAGS_DEBUG "" CACHE STRING "" FORCE )
You can’t perform that action at this time.
0 commit comments