From: NAKAMURA Takumi Date: Fri, 21 Aug 2015 09:38:46 +0000 (+0000) Subject: [CMake][Standalone] Detect Python. Python is used for Lit testing. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ab56c1e1783d795d108bb1b4b12fcdd785a245c;p=clang [CMake][Standalone] Detect Python. Python is used for Lit testing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245685 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 67b44ffa84..87c9ce8286 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,19 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) if(LLVM_INCLUDE_TESTS) + set(Python_ADDITIONAL_VERSIONS 2.7) + include(FindPythonInterp) + if(NOT PYTHONINTERP_FOUND) + message(FATAL_ERROR +"Unable to find Python interpreter, required for builds and testing. + +Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") + endif() + + if( ${PYTHON_VERSION_STRING} VERSION_LESS 2.7 ) + message(FATAL_ERROR "Python 2.7 or newer is required") + endif() + # Check prebuilt llvm/utils. if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX} AND EXISTS ${LLVM_TOOLS_BINARY_DIR}/count${CMAKE_EXECUTABLE_SUFFIX}