From 5ca77b18d2d17afa0c4b168383d14762e118949e Mon Sep 17 00:00:00 2001 From: Matej Kenda Date: Wed, 11 Dec 2019 14:58:29 +0100 Subject: [PATCH] gh-327: Use "include(FindPythinInterp)" when compiling with CMake older than 3.12. Signed-off-by: Matej Kenda --- bindings/python/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index a803ee2bf..494aebbb4 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -1,7 +1,16 @@ cmake_minimum_required(VERSION 2.8.7) project(libiio-py NONE) -find_package (Python COMPONENTS Interpreter) +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + include(FindPythonInterp) + + # Set variables as they would be set by module FindPython, + # which is available from CMake 3.12. + set(Python_Interpreter_FOUND ${PYTHONINTERP_FOUND}) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) +else() + find_package (Python COMPONENTS Interpreter) +endif() if (Python_Interpreter_FOUND) option(PYTHON_BINDINGS "Install Python bindings" ON)