cancel
Showing results for 
Search instead for 
Did you mean: 

How to import a STM32CubeMX2 CMake project into STM32CubeIDE

Mohamed_BACHOUCH
ST Employee

Summary

This guide explains how to take an existing STM32CubeMX2 project, generate a CMake project from it, and then import it into STM32CubeIDE.

Prerequisites

1. Generate a CMake project from STM32CubeMX2

  1. Create an STM32CubeMX2 .ioc project.
  2. In Project Manager → IDE Project (IDE Project Generation area), set:
    • Format: CMake
    • CMake toolchain: GCC
    • Destination: a folder where the CMake project should generate.
  3. Click Generate IDE project.

When generation completes, verify that the destination folder contains:

  • CMakeLists.txt
  • Core/, Drivers/, and other generated folders.
  • The .ioc file.

Figure 1. IDE project generationFigure 1. IDE project generation

 

2. Open the STM32CubeMX2 CMake project in STM32CubeIDE

  1. Launch STM32CubeIDE V2.1.1 and select your workspace.
  2. From the main menu, choose:
    [File] → [New] → [STM32 Project] → [STM32 Project Create/Import].
    Select [STM32CubeMX2 project] under [Create New STM32 Project].

Figure 2. Import STM32 projectFigure 2. Import STM32 project

 

 

Figure 3. Import STM32CubeMX2 projectFigure 3. Import STM32CubeMX2 project

3. Point the project to the existing CMake sources

You are now on the Project with existing CMake sources page. Fill in the fields as follows:

  • Project name
    Enter a name for your STM32CubeIDE project.
  • Source directory
    Click [Browse...], and select the folder generated in section 1.

Figure 4. Point the project to the existing CMake sourcesFigure 4. Point the project to the existing CMake sources

4. Configure the toolchain and MCU

The wizard opens the "Configure default tool‑chain settings for the project" page.

  1. Configure:
    • Toolchain: MCU ARM GCC (or matching your setup).
    • MCU: Select the same device as in the STM32CubeMX2 project.
    • Example used: STM32C562VETx.
  2. Click Finish.

Figure 5. Configure the toolchain and MCUFigure 5. Configure the toolchain and MCU

5. Build and use the imported project

In "Project Explorer", the new STM32 CMake project should be visible:

  • CMakeLists.txt at the root.
  • Core/, Drivers/, and other generated folders.

[Right‑click] the project → [Build Project].

STM32CubeIDE runs CMake, configures the build system, and compiles the code.

Related links

Comments
Tom_pm
Associate III

Minor typo in section 4. The image show STM32C562VETx and the description says "Example used: STM32C562RETx"

Laurids_PETERSEN
Community manager

Thanks for catching that @Tom_pm. I have updated the article accordingly.

Version history
Last update:
‎2026-04-20 4:31 AM
Updated by: