From 3017907fd83d32e89e91f43a5d2b94d4155beddd Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 27 Dec 2010 13:56:09 -0800 Subject: cmake: changes to finding python interp, some other tweaks --- host/config/Python.cmake | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'host/config/Python.cmake') diff --git a/host/config/Python.cmake b/host/config/Python.cmake index 847e7bff3..49f74ae88 100644 --- a/host/config/Python.cmake +++ b/host/config/Python.cmake @@ -18,13 +18,33 @@ ######################################################################## # Setup Python ######################################################################## -IF(NOT DEFINED PYTHON_EXECUTABLE) - INCLUDE(FindPythonInterp) +#this allows the user to override PYTHON_EXECUTABLE +IF(PYTHON_EXECUTABLE) + SET(PYTHONINTERP_FOUND TRUE) + +#otherwise if not set, try to automatically find it +ELSE(PYTHON_EXECUTABLE) + + #use the built-in find script + FIND_PACKAGE(PythonInterp) + + #and if that fails use the find program routine IF(NOT PYTHONINTERP_FOUND) - MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.") + FIND_PROGRAM(PYTHON_EXECUTABLE python) + IF(PYTHON_EXECUTABLE) + SET(PYTHONINTERP_FOUND TRUE) + ENDIF(PYTHON_EXECUTABLE) ENDIF(NOT PYTHONINTERP_FOUND) -ENDIF(NOT DEFINED PYTHON_EXECUTABLE) + +ENDIF(PYTHON_EXECUTABLE) + +#make the path to the executable appear in the cmake gui +SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE PYTHON_EXECUTABLE "python interpreter") + +IF(NOT PYTHONINTERP_FOUND) + MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.") +ENDIF(NOT PYTHONINTERP_FOUND) MACRO(PYTHON_CHECK_MODULE desc mod cmd have) MESSAGE(STATUS "") -- cgit v1.2.3