Skip to main content
av500
Associate II
March 30, 2026
Solved

CubeMX2: generated cmake files state version 3.20, but in fact version 3.30 is needed

  • March 30, 2026
  • 3 replies
  • 321 views

when generating cmake file from CubeMX2, CMakeLists.txt states:

cmake_minimum_required(VERSION 3.20)

but in fact you need a minimum version of 3.3:

Screenshot_20260330_080530.pngScreenshot_20260330_080658.png

Best answer by Saket_Om

Hello ​@av500 

This issue is resolved starting from STM32CubeMX version 1.1.0.

3 replies

ST Technical Moderator
March 30, 2026

Hello @av500 

Thank you for bringing this issue to our attention.

I reported this internally.

Internal ticket number: CDM0060487

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
ST Technical Moderator
April 22, 2026

Hello @av500 

The issue is caused by the following lines in stm32c5xx_dfp/CMakeLists.txt:

# Include RTE_Components.h globally if needed
if(CMSIS_Tcompiler STREQUAL "IAR")
 target_compile_options(STMicroelectronics_stm32c5xx_dfp_2_0_0 INTERFACE "SHELL:--preinclude $<QUOTE>${CMAKE_CURRENT_LIST_DIR}/RTE_Components.h$<QUOTE>")
else()
 target_compile_options(STMicroelectronics_stm32c5xx_dfp_2_0_0 INTERFACE "SHELL:-include $<QUOTE>${CMAKE_CURRENT_LIST_DIR}/RTE_Components.h$<QUOTE>")
endif()

It can be fixed quite simply by changing the lines slightly to use an escaped quote (\") instead of <QUOTE>. This keeps compatibility with older versions:

# Include RTE_Components.h globally if needed
if(CMSIS_Tcompiler STREQUAL "IAR")
 target_compile_options(STMicroelectronics_stm32c5xx_dfp_2_0_0 INTERFACE "SHELL:--preinclude \"${CMAKE_CURRENT_LIST_DIR}/RTE_Components.h\"")
else()
 target_compile_options(STMicroelectronics_stm32c5xx_dfp_2_0_0 INTERFACE "SHELL:-include \"${CMAKE_CURRENT_LIST_DIR}/RTE_Components.h\"")
endif()

 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
Saket_OmBest answer
ST Technical Moderator
August 12, 2026

Hello ​@av500 

This issue is resolved starting from STM32CubeMX version 1.1.0.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om