pathclionpythoninterpreter

CMake can't find python3


In my CMake I have:

find_package(PythonInterp 3.6 REQUIRED)

This works fine when I execute cmake ., because I have python3.6 in /opt/local/bin. However, when CLion executes the same cmake, it is unable to find it. How can I make it aware?

I tried adding /opt/local/bin to PATH and adding a python interpreter setting, but nether worked for that.


Solution

  • I was able to figure it out. It is possible to add env variables to cmake execution: look for env in here https://cmake.org/cmake/help/latest/manual/cmake.1.html

    Knowing this it was easy to add it in clion: Settings/Preferences -> Build, Execution, Deployment -> CMake -> CMake Options

    and add into that field env PATH=${PATH}:/opt/local/bin.