From 134e3831f20f5806c616f27c00ed51a7edd389d6 Mon Sep 17 00:00:00 2001 From: Håkon Vågsether Date: Sun, 18 Mar 2018 01:18:05 +0100 Subject: cmake: Fixed the Python executable finding logic Reviewed-by: Brent Stapleton --- host/cmake/Modules/UHDPython.cmake | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'host/cmake/Modules') diff --git a/host/cmake/Modules/UHDPython.cmake b/host/cmake/Modules/UHDPython.cmake index ee78f914c..f8f3686c8 100644 --- a/host/cmake/Modules/UHDPython.cmake +++ b/host/cmake/Modules/UHDPython.cmake @@ -22,11 +22,20 @@ IF(PYTHON_EXECUTABLE) ELSE(PYTHON_EXECUTABLE) #use the built-in find script - FIND_PACKAGE(PythonInterp) + IF(ENABLE_PYTHON3) + FIND_PACKAGE(PythonInterp 3.0) + ELSE(ENABLE_PYTHON3) + FIND_PACKAGE(PythonInterp 2.0) + ENDIF(ENABLE_PYTHON3) #and if that fails use the find program routine IF(NOT PYTHONINTERP_FOUND) - FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python python2.7) + IF(ENABLE_PYTHON3) + FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python3 python3.5 python3.6) + ELSE(ENABLE_PYTHON3) + FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python2 python2.7) + ENDIF(ENABLE_PYTHON3) + IF(PYTHON_EXECUTABLE) SET(PYTHONINTERP_FOUND TRUE) ENDIF(PYTHON_EXECUTABLE) -- cgit v1.2.3