cancel
Showing results for 
Search instead for 
Did you mean: 

How to compile a CMake Project created with CubeMX in CubeIDE

killa-pixel
Visitor

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?

3 REPLIES 3
Pavel A.
Evangelist III

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.

 

 

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.

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)