]> granicus.if.org Git - clang/commitdiff
[CMake][Standalone] Detect Python. Python is used for Lit testing.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 21 Aug 2015 09:38:46 +0000 (09:38 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 21 Aug 2015 09:38:46 +0000 (09:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245685 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt

index 67b44ffa84eb44cef9283686dc9b6d3edd42c509..87c9ce8286828fb9e2bdb0e291664b0cbd008241 100644 (file)
@@ -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}