cancel
Showing results for 
Search instead for 
Did you mean: 

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

av500
Associate II

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 2
Saket_Om
ST Employee

Hello @av500 

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
Saket_Om
ST Employee

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

 

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