CMake with CLion - working!

permal
Posts: 342
Joined: Sun May 14, 2017 5:36 pm

CMake with CLion - working!

Postby permal » Tue Oct 02, 2018 8:54 pm

Now that we have the new CMake support I decided to try to get it to work with CLion, my C++ IDE of choice. After some initial head-scratching I can now compile entire projects from within CLion. Code completation is also working. Awesome.

There is one key point to get it working:
  • When CLion launches CMake, environment variables from for example ~./bashrc are NOT propagated to the CMake process. As such your ${IDF_PATH}, ${PYTHON} and ${PATH} are blank causing things to break.
Also, when initially setting things up, the menu option Tools->CMake->Reset Cache and reload project is your friend when CMake complains about xtensa-esp32-elf-cc not being able to compile a simple C program.

I've not yet tried to debug via CLion and I doubt that is possible, but JetBrains have stated that they're going to put resources into embedded programming with CLion so we might eventually get that too. See this ticket, go up vote and put a note about ESP32-development. :)

The screenshots below shows how I set up CMake and Toochain. I had to delete the default one, otherwise CLion didn't want to use the one I specified for xtensa; not sure if that is a bug or me missing something.
clion-xtensa-toolchain.png
clion-xtensa-toolchain.png (83.15 KiB) Viewed 1418 times
clion-xtensa-cmake-config-environment-variables.png
clion-xtensa-cmake-config-environment-variables.png (23.76 KiB) Viewed 1418 times
clion-xtensa-cmake-config.png
clion-xtensa-cmake-config.png (96.22 KiB) Viewed 1418 times

User avatar
hassan789
Posts: 142
Joined: Thu Jun 29, 2017 2:15 am

Re: CMake with CLion - working!

Postby hassan789 » Fri Nov 02, 2018 10:14 pm

Great work. Been looking for an alternative to eclipse

permal
Posts: 342
Joined: Sun May 14, 2017 5:36 pm

Re: CMake with CLion - working!

Postby permal » Fri Nov 02, 2018 10:23 pm

hassan789 wrote:Great work. Been looking for an alternative to eclipse
Please see this post. It has turned out that this is not reliable: viewtopic.php?f=13&t=7535&p=33004#p33004

Who is online

Users browsing this forum: Aybood, Google [Bot], kurta999 and 11 guests