CLion has the ability to support nested CMakeLists.txt files, as per CMakeLists.txt | CLion. I want to use this feature (or similar) so I can combine the code for a PlatformIO firmware project and a related desktop GUI tool in the same CLion project. The PlatformIO firmware and the GUI tool share some common code, and ideally I’d like to seamlessly work on the firmware, GUI, and common code all at once.
I tried putting the firmware code, GUI code and shared code in three subdirectories, with a parent CMakeLists.txt file containing the following:
cmake_minimum_required(VERSION 3.13) project(MyProject) add_subdirectory(firmware) add_subdirectory(gui)
This doesn’t work however, because when I try to create a PlatformIO run configuration I get an error saying this isn’t a PlatformIO project. Presumably the PlatformIO plugin is only looking in the root directory for platformio.ini?
I also tried leaving platformio.ini in the root directory and using a CMakeListsUser.txt file containing:
This gets closer, but the gui build fails, I think because it has picked up the wrong toolchain from PlatformIO’s CMakeListsPrivate.txt file.
Am I just doing something stupid, or this a genuine problem? Is there any workaround or solution to this?