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.
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.