STM32-Template
STM32-Template copied to clipboard
Adding a CMakeLists.txt
Hello!
I have a CMakeLists.txt
version of the Makefile
and Makefile.common
and I think it'd be a good idea to add it, some of my reasons are:
- A decent amount of people use IDEs for their projects, sure,
Makefiles
work well enough with IDEs but not always- And even if they don't use IDEs, a
CMakeLists.txt
does make life easier for debugging and suggestions/completions
- And even if they don't use IDEs, a
- I think a
CMakeLists.txt
that can be used as a template is in line with what is taught/learned through theDiscovering STM32
book - And it gives the user freedom of choice!
Now, some details regarding the CMakeLists.txt file I have been using:
- It is a single file that simulates both the
Makefile
and theMakefile.common
, I am open to changing it from 1 file to 2 files that are closer to the currentMakefile
layout if it's truly wanted/needed - There are modifications that I know I'd have to make so its more of a template, namely:
- Lines
14
to16
which just link the library directly, instead I would add theLIBROOT
so it matches theMakefile.common
- Adding
TOOLROOT
as well since my compiler is available in the search path and installed system-wide but that is not the case for everyone - Organize the file a bit more since I was jumping between looking at what the
Makefile
andMakefile.common
did and modifying or adding things as I needed them - As you can see on lines
29
to35
we have to manually add the files, I would add variables so we shorten this- Example:
${PERIPH_SRC}/stm32f10x_gpio.c
- Obviously the naming convention is up for discussion haha
- Example:
- Lines
Excited to hear what you think about this idea!