-
Notifications
You must be signed in to change notification settings - Fork 2
CMake
CMake variables can be defined and passed to CMake during builds. For example with Zephyr, building with a shield board uses a CMake variable to include the shield of the devicetree and Kconfigs in the build. When building for the G1120B0MIPI display shield with command line, -DSHIELD=g1120b0mipi
is added to the command for CMake.
CMake variables can also be added in a VS Code project with the MCUXpresso extension. After creating/importing the project, open the project file CMakePresets.json
. Add the variable to the cacheVariables
group. In this example, the line "SHIELD": "g1120b0mipi"
was added. The CMakePresets.json file includes different build configurations, typically a Debug and Release build configs. The CMake variables should be added to each build config that are needed. The image below shows adding the SHIELD
variable to the debug
build config.
Save the file, clean and build the project. Now the new CMake variable is included in the build.
It is recommended to use the CMakePresets.json
file when defining any additional CMake variables, this allows you to define different variables per build configuration as needed. settings.json
is another file where CMake variables may be stored. To move the CMake variables to presets simply remove them from settings.json
file and add them to CMakePresets.json
under cacheVariables
.
You can define additional CMake variables to the CMakePresets.json
file using the UI by navigating to the Build Configurations section of your project. Choose the build configuration you want to modify, then add your CMake variables in the CMake Extra Args
text field.
Use this GitHub Issues section to report ambiguities or problems encountered in this documentation. For MCUXpresso for Visual Studio Code extension issues, feedback or search for solutions and ideas please follow Community page.
Table of contents
Dependency Installation
General
Software Repositories
Project Management
Flash and Debug
Reference Guides
- Getting Started with MIMXRT1060-EVK
- Training Zephyr Getting Started
- TrustZone Examples on LPC55S6x and MCUXpresso SDK
- Multicore Examples on LPC55S6x and MCUXpresso SDK
- SDRAM Examples on RT1060 and MCUXpresso SDK
- Getting Started with MCX using Application Code Hub
- AN14120: Debugging Cortex-M on i.MX 8M, i.MX 8ULP, and i.MX 93
Troubleshooting
Useful links