From 69b35f985711efc55740bc9e10567c5717e130a6 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 13 Oct 2020 16:36:33 -0500 Subject: [PATCH] build: Actually search for Python 3 interpreter before using it. --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32e7b7ed0..93237f82a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,17 @@ find_package(cJSON) find_package(Systemd) find_package(OpenGLES COMPONENTS V3) +if(NOT CMAKE_VERSION VERSION_LESS 3.12) + find_package(Python3 REQUIRED Interpreter) + set(PYTHON_EXECUTABLE Python3::Interpreter) +else() + find_package(PythonInterp REQUIRED VERSION 3) + if(PYTHON_EXECUTABLE MATCHES "WindowsApps") + # If you hit this error, you will have to install Python 3 or try harder to tell CMake where it is. + message(FATAL_ERROR "Found WindowsApps alias for Python. Make sure Python3 is installed, then choose 'Manage App Execution Aliases' in Start and disable the aliases for Python.") + endif() +endif() + add_library(xrt-pthreads INTERFACE) if(WIN32) find_package(pthreads_windows REQUIRED)