This repository was archived by the owner on Jan 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
VS Code Setup
Jamie Smith edited this page Mar 17, 2021
·
7 revisions
mbed-cmake and Visual Studio Code make a solid pair, and provide an editing experience equal to or better than Mbed's own IDE for zero dollars down.
- Make sure the "C/C++", "CMake Tools", "Native Debug", and "CMake" extensions are installed.
- In VS Code, go to File > Open Workspace and select your project folder.
- Set up your CMake options. You can do this through cmake.configureSettings in settings.json. However, if your project supports multiple targets, you will need to handle this using a CMake variants file. Here's one I wrote for my project with three boards:
buildType:
default: RelWithDebInfo
choices:
RelWithDebInfo:
short: RelWithDebInfo
long: Emit debug information but also optimize
buildType: RelWithDebInfo
debug:
short: debug
long: Emit debug information and don't optimize
buildType: Debug
release:
short: Release
long: Optimize generated code
buildType: Release
board:
default: GroundStationV1
choices:
GroundStationV1:
short: GroundStationV1
settings:
TARGET: GroundStationV1
GroundStationV2:
short: GroundStationV2
settings:
TARGET: GroundStationV2
TransponderV1:
short: TransponderV1
setting:
TARGET: TransponderV1
- Select your variant. Use Ctrl-Shift-P and find
CMake: Select Variant
.
- Configure the project. Use Ctrl-Shift-P and find
CMake: Configure
. Note: As of mbed-cmake 1.6.0, you should not need to select a kit, VS Code should find the compilers automatically once CMake has configured. - If there's a popup asking if CMake should provide IntelliSense information, say yes!
- Done!