Skip to main content
VPant.7
Associate II
March 30, 2026
Question

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

  • March 30, 2026
  • 2 replies
  • 197 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

2 replies

Technical Moderator
March 30, 2026

Hello @VPant.7 

Thank you for bringing this issue to our attention.

I reported this internally.

Internal ticket number: CDM0060487

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question.Saket_Om"
Technical Moderator
April 22, 2026

Hello @VPant.7 

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()

 

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question.Saket_Om"