I'm new here, but I've been using Arduino for a long time now.
This year I followed a programming course about C at my University and I learnt how to use CMake to compile programs.
I came here to ask you if there's a way to use it together with Arduino, bypassing the Arduino IDE.
I searched a lot on the Internet, but the guides I found aren't much helpful.
Could someone suggest me a good guide or point me in the right direction?
I can work both on Linux (Ubuntu) and Windows.
Which microcontroller do you want to target?
Hi here is a link for you on creating cmake files for Arduino.
Here's what I use:
It uses modern target-based CMake, using toolchain files to select different boards.
The CMakeLists file for a simple “blink” example looks like this:
The Arduino core files are compiled into a library in cmake/arduino_core.cmake.
The executable is converted into a .HEX file using cmake/arduino_hex.cmake, and this .HEX file is uploaded using avrdude in cmake/arduino_upload.cmake.
It doesn't do anything fancy, but it works just fine, and it is simple enough to understand and modify yourself: it's just 160 lines of CMake scripting.