I have a PlatformIO codebase from a couple of years ago that I was building and deploying from CLion successfully, and am now trying to revive. I was very pleased to see there is now a PlatformIO plugin for CLion, but I’m having trouble getting it working with this code.
My code builds four different binaries that I deploy to four different physical boards (two Teensy, two ATmega328). Each target has its own directory containing source code, CMakeLists.txt etc. Between them they also share some common library code (custom code for dealing with sensors, Bluetooth, LEDs etc). I have separate CMakeLists.txt and CMakeListsPrivate files for each target, and in each CMakeLists.txt I have unique
add_custom_target() blocks for them all, so I could build/deploy them as separate Run Configurations within my old CLion setup.
Now that I’ve updated CLion and am using the PlatformIO plugin, I updated CMakeLists.txt files with “platformio init --ide clion”. The CMakeLists.txt files all end up with the same “Production ALL”/Debug ALL" targets. This then fails to build with:
CMake Error at jacket/CMakeLists.txt:21 (add_custom_target):
add_custom_target cannot create target “Production” because another target
with the same name already exists.
My question is, what is the best way to deal with this? Should I break my CLion project in to four separate ones? Or can src_filter build option help here? Any tips on the best approach would be much appreciated.