I followed this link to be able to use CLion for arduino projects using Platformio. I'm having two issues that I'll post here as I think that might be related.
First Issue
I'm getting stuck in the last step, which says
Build project (DO NOT use “Run” button, see marks on the screenshot above): Menu: Run > Build.
As you can see in the next image, PLATFORMIO_BUILD target is broken and I can't run it.
Editing configurations looks like this, and I don't know if its meant to be like this. As you can see in the next image, the error says: Target PLATFORMIO_BUILD not found.
I've repeated the procedure several times, with no luck. CLion is 2017.2.3 and Platformio is last version as well.
The project itself is fine, since if I run platformio run --target upload
from the command line, the project compiles and is uploaded to the arduino.
Second Issue
All files in my project show a yellow header saying:
This file does not belong to any project target, code insight features might not work properly
Due to this, many of the benefits of using CLion are gone.
All these files, as well as the folders containing them are greyed out. I'm not sure if I should include them manually on CMAKELists, but as I understood, the command platformio init --ide clion --board uno
already takes care of this.
It's first time using CLion and might be that the problem resides in some basic configuration I'm not aware of. Thanks!
Solved. Checking the CMake log I was getting the following error:
Error:The C compiler "/usr/bin/cc" is not able to compile a simple test program. It fails with the following output: Change Dir: /Users/... .../default/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/make" "cmTC_ab383/fast" xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun CMake will not be able to correctly generate this project. Error:Configuration Debug The C compiler "/usr/bin/cc" is not able to compile a simple test program.
Same problem was found here, and here, and the solution in my case was to uninstall the Command Line Tools:
rm -rf /Library/Developer/CommandLineTools
and reinstall them again:
xcode-select --install