cancel
Showing results for 
Search instead for 
Did you mean: 

CMakeLists.txt should use file(GLOB_RECURSE) instead of manually listing each file

ianzone
Associate III
When generating a CMake-based STM32 project, STM32CubeMX currently lists every single .c source file manually in CMakeLists.txt.
 
This brings major inconvenience for users:
  • When adding user drivers (e.g., sensor, flash, display, or custom modules), users must manually edit CMakeLists.txt and add each new .c file path.
  • If the user adds many source files, this process is error-prone and inefficient.
  • It does not match modern CMake project practices and reduces project maintainability.
 
Suggestion:

Please use file(GLOB_RECURSE ...) to automatically include source files from standard directories such as:
  • Core/Inc/*.h
  • Core/Src/*.c
1 REPLY 1
Ghofrane GSOURI
ST Employee

Hello @ianzone 

First let me thank you for posting.

Your change request has been escalated to the development team and is being tracked under internal ticket ID #0062844 for further investigation and feasibility assessment.

THX

Ghofrane

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.