I have a folder, as below:
top-level/ CMakeLists.txt. <===== A projectB/ platformio.ini <============ With environments [env:B_X], [env:B_Y] etc. src/ ... CMakeLists.txt. <===== B projectC/ platformio.ini <============ With environments [env:C_X], [env:C_Y] etc. src/ ... CMakeLists.txt <===== C
I want to be able to invoke cmake at the top level directory (corresponding to CMakeLists.txt # A), and build specific environments from within my
projectC folders using calls to
add_subdirectory(projectC). For example, I want the following environments built/flashed/monitored under the projectB and projectC folders:
ProjectB: [env:B_X] [env:B_Y] ProjectC: [env:C_X] [env:C_Y]
… and I want the following pio commands run for the below targets:
Build: pio run Flash: pio flash Monitor: pio monitor
I’m looking for advice on what the contents of the respective CMakeLists.txt files – #A, #B and #C – need to be, to create the
flash`` and monitor``` targets above.
My thinking is that I need to use cmake’s
add_custom_command() function somewhere, to trigger calls to
pio run flash etc, but I’m a cmake newbie, and need some handholding with this.
Example snippets or github link would be greatly appreciated!