Page 1 of 2

CMake / CLion

Posted: Sat Jun 24, 2017 6:34 pm
by permal

Are there any plans to provide a guide on how to setup an ESP32/IDF build using CMake (and thus enabling use of all the build generators it supports) just as is provided for Eclipse? So far my attempts to get xtensa-gcc to work with CMake fails at the stage where CMake tries to compile a test program to determine the capabilities of the compiler.

I've setup my CLion to build using the regular CLI/make and a CMakeLists.txt to get code completion working. While this is a good step forward, it'd be even better to actually utilize the power of CMake and eventually debug via GDB from within CLion.


Re: CMake / CLion

Posted: Sun Jun 25, 2017 12:04 pm
by ESP_igrr
We don't have plans for CMake support, but we can help with compilation issues you are seeing. Can you attach compiler output and the test program which CMake is trying to compile?

Re: CMake / CLion

Posted: Sun Jun 25, 2017 1:32 pm
by permal
I tried to get the source CMake tries to build, but it seems to delete it immediately after failing to compile.

Since I wrote the initial question I've also realized that it'll take a lot of more work to get it all up and running so I'm refocusing on learning ESP-IDF instead. After all, I have code completion working and it all compiles directly from CLion via make.

Re: CMake / CLion

Posted: Thu Nov 02, 2017 2:41 pm
by Beck-Sisyphus
Following this thread for progress. It will be great if ESP32 works for CMake / CLion!

Currently manually add include_directories() in CMakeLists.txt for looking into code.

Re: CMake / CLion

Posted: Fri Nov 03, 2017 11:39 am
by Gfast2

I've got the same wish. But going to walk through another way:
This is still not Finished. Because the library will not be used shortly. But with the help from the AWESOME esp-idf Team, The library which use cmake to compile firstly get compiled beautifully.

Stay tune.


Re: CMake / CLion

Posted: Sat Dec 30, 2017 11:35 am
by hilmarv
permal wrote:After all, I have code completion working and it all compiles directly from CLion via make.
Can you explain for a rookie how you achieved this? Haven't coded C for a while :)

Thanks in advance!

Re: CMake / CLion

Posted: Sun Dec 31, 2017 7:35 am
by permal
I simply set up the CMakeLists.txt like any other project. Then I configured Clion to parse the output of an external tool that calls the correct make.

Since I asked the original question I’ve expanded my project to also include the ability to compile large parts on Linux, but since that is mostly only code you can still gain some info from my repo.

Re: CMake / CLion

Posted: Tue Apr 02, 2019 10:12 am
Does anyone have a clear walk through for setting up CLion to use with an esp-idf project.
I have burnt several days trying to get configured, but I suspect it's falling down somewhere in the tool chain setup.


Re: CMake / CLion

Posted: Wed Apr 03, 2019 6:40 am
by ESP_cermak

Configuring CLion with CMake IDF build system is very simple, that is: no configuration needed ;) Just open an existing project, where your project CMakeLists.txt resides, possibly set your IDF_PATH and a generation path (to be in line with `` so you can conveniently run flash/monitor from IDE).
At least this is true for linux and mac, on windows might be a bit tricky, because you cannot simply configure which generator CMake uses when executed from CLion. The easiest way was to install visual studio (at least at the time I've tried), which would cause run CMake with VS's nmake generator and build correctly. Of course standard windows tools like cmake, python (+packages), mconf-idf (for native windows terminal, not MSYS) need to be installed per ... setup.html

Re: CMake / CLion

Posted: Wed Apr 03, 2019 8:11 am
Yes, I should have mentioned I am using Windows.

Thanks for the link.