Skip to main content
Visitor II
July 5, 2024
Question

How to use CMake generated projects from CubeMX?

  • July 5, 2024
  • 1 reply
  • 1698 views

I have recently used CubeMX to generate C code for a microcontroller that I have used previously. I decided to generate a project using the new CMake option as I have in the past used the Makefile option and migrated it over to CMake. Truth be told, I do not really know how to use CMake all that well. So if I had just generated a brand new CMake project from CubeMX, how do I use the files it generated to compile a binary? I am using WSL 2 Linux to run commands, any help is greatly appreciated, thanks.

I see there is a CMakePresets.json file, what is that? I want to generate a compile_commands.json for my clangd as well.

1 reply

Nawres GHARBI
Technical Moderator
July 9, 2024

hi @semmens1 

We invite you to build it using the latest version of the VSCode extension which is available on Linux

CMakePresets.json is the file containing presets for build and configuration under VSCode