-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
83 lines (61 loc) · 3.7 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#
# Mbed CE Hello World Project
#
cmake_minimum_required(VERSION 3.19)
cmake_policy(VERSION 3.19)
#### Initialize Mbed OS build system. ####
######################################################################################################
### Block of including .json5 files. Files of this block must be included before the app.cmake
#[[ Set path of mbed_app.json (necessary at all times) ]]
set(MBED_APP_JSON_PATH mbed_app.json5)
###---------------------------------------------------------------------------------------------------
#[[ This part is dedicated for custom targets only! Settings below activate targets from
custom_targets.json5 and upload method config, otherwise lines below should be commented. ]]
#[[ Here set path for custom_targets.json5 (this is our default) ]]
#set(CUSTOM_TARGETS_JSON_PATH custom_targets/custom_targets.json5)
#[[ Here you can set path for custom upload config .cmake (optional example) ]]
#set(CUSTOM_UPLOAD_CFG_PATH ${CMAKE_SOURCE_DIR}/${MBED_TARGET}/${MBED_TARGET}.cmake)
#[[ Note: For custom target you need also an upload method and we have few options how you can do that
- use the variable CUSTOM_UPLOAD_CFG_PATH above
- use default expected path for custom targets upload methods where you create your own config
MY_PROJECT/custom_targets/upload_method_cfg
- of course you can do it by yourself directly via cmake in this file
For more visit https://github.com/mbed-ce/mbed-os/wiki/Upload-Methods ]]
### End of block
######################################################################################################
### include app.cmake (necessary everytime) ###
include(mbed-os/tools/cmake/app.cmake)
######################################################################################################
### Block of including project folders
#[[ If using a custom target, the subdirectory containing the custom target must be included before
the mbed-os subdir, otherwise the next line should be commented]]
#add_subdirectory(custom_targets)
###--------------------------------------------------------------------------------------------------
## Add mbed-os subdirectory (necessary everytime)
add_subdirectory(mbed-os)
###--------------------------------------------------------------------------------------------------
## Add another subdirectory, for example subdirectory of a library (if needed)
#add_subdirectory(YourLibrary)
### End of block
######################################################################################################
### Set up your project name (necessary everytime)
project(MbedCEHelloWorld)
### add executable (necessary everytime)
add_executable(${CMAKE_PROJECT_NAME} main.cpp)
######################################################################################################
### Link libraries block
#[[For more about this configuration visit wiki page MbedOS-configuration
https://github.com/mbed-ce/mbed-os/wiki/MbedOS-configuration#configuration-via-cmake-files]]
#[[link MbedOS and its libraries (necessary everytime)]]
target_link_libraries(${CMAKE_PROJECT_NAME} mbed-os)
### link user library (if needed)
#target_link_libraries(${CMAKE_PROJECT_NAME} YourLibrary)
### End of block
######################################################################################################
### Set post build (necessary everytime)
mbed_set_post_build(${CMAKE_PROJECT_NAME})
#[[ Note: if you wish to use a custom linker script instead of the default Mbed one for
your target, you can do that with mbed_set_post_build(${CMAKE_PROJECT_NAME} path/to/linker_script.ld) ]]
### Call this last, after creating all targets. It writes out IDE configuration files
### so that you can run your targets in VS Code.
mbed_finalize_build()