FindPythonInterp.cmake doesn't properly check find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES}) for failure
EDIT: whoops, looks like a bad cached variable!
At line 79, CMake looks for a Python executable:
find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})`
...and then later, CMake checks the result for failure incorrectly, at line 102:
# Search for newest python version if python executable isn't found
if(NOT PYTHON_EXECUTABLE)
The find_program
documentation says :
If nothing is found, the result will be -NOTFOUND, and the search will be attempted again the next time find_program is invoked with the same variable.
If I understand what's going on, This leads to some pretty kooky behavior on my local machine while building LLVM, where Python 3.4 is NOT installed, Python 2.7 & Python 3.5 are, and yet CMake tries to execute_process
Python 3.4:
.....and then (surprise!) reports that it couldn't find a Python executable:
...causing configuring/build generation to fail: