Skip to main content
Associate
November 29, 2024
Question

How to compile a CMake Project created with CubeMX in CubeIDE

  • November 29, 2024
  • 1 reply
  • 2057 views

I am using CubeMX 6.13 to generate a project. Because I want the project to be build with CMake, under Project Manager I have selected "Toolchain / IDE = Cmake".
The generated project can be compiled with cmake from command line.

Then I open the project in CubeIDE with "File->Open Projects from File System"
I also tried "Import... -> Existing Projects into Workspace"

The Build button is grayed out and when I go to "Project->Properties" there is no "C/C++ Build" entry on the left, where one could configure the CMake Settings.

When I create a new "STM32 CMake Project" via CubeIDE everything works as expected.

There is a very similar post here but the only answer is from the post creator basically saying: look at AN5952 but I don't find that helpful or applicable.

What am I missing?

1 reply

Pavel A.
Super User
November 29, 2024

Because I want the project to be build with CMake

If you actually want to build with CubeIDE, select CubeIDE when generating the project. Simple, eh?

Maybe one day Eclipse CDT will support CMake natively but this has not happened yet.

 

 

Associate
November 29, 2024

Thanks for your reply but I don't think it is "simple" as it is very much possible to compile CMake projects with CubeIDE when they were created by CubeIDE, so obviously it must be possible.
I chose cmake for automated builds on a build server, but I would like to be able to use CubeIDE to build and debug.

Pavel A.
Super User
November 30, 2024

Yes it looks like CubeIDE, per AN5952, generates CMake projects differently than CubeMX does. And CubeIDE can open by "Open projects from filesystem" only projects that it created. CubeMX does not create the extra stuff needed for Eclipse (.project and .cproject)