Index: cmake/modules/LLDBConfig.cmake =================================================================== --- cmake/modules/LLDBConfig.cmake +++ cmake/modules/LLDBConfig.cmake @@ -208,6 +208,14 @@ message("-- LLDB Found PythonIncludeDirs: ${PYTHON_INCLUDE_DIRS}") endfunction(find_python_libs_windows) +set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5) +find_package(PythonInterp) +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 (NOT LLDB_DISABLE_PYTHON) if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") @@ -218,18 +226,16 @@ add_definitions( -DLLDB_PYTHON_HOME="${LLDB_PYTHON_HOME}" ) endif() else() - find_package(PythonLibs REQUIRED) + find_package(PythonLibs ${PYTHON_VERSION_STRING} REQUIRED) endif() - + if (PYTHON_INCLUDE_DIRS) include_directories(${PYTHON_INCLUDE_DIRS}) endif() endif() if (LLDB_DISABLE_PYTHON) - unset(PYTHON_INCLUDE_DIRS) - unset(PYTHON_LIBRARY) - add_definitions( -DLLDB_DISABLE_PYTHON ) + add_definitions(-DLLDB_DISABLE_PYTHON) endif() if (LLVM_EXTERNAL_CLANG_SOURCE_DIR) Index: cmake/modules/LLDBStandalone.cmake =================================================================== --- cmake/modules/LLDBStandalone.cmake +++ cmake/modules/LLDBStandalone.cmake @@ -87,18 +87,6 @@ include(HandleLLVMOptions) include(CheckAtomic) - if (PYTHON_EXECUTABLE STREQUAL "") - set(Python_ADDITIONAL_VERSIONS 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5) - 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() - else() - message("-- Found PythonInterp: ${PYTHON_EXECUTABLE}") - endif() - # Import CMake library targets from LLVM and Clang. include("${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm/LLVMConfig.cmake") if (EXISTS "${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang/ClangConfig.cmake") Index: docs/CMakeLists.txt =================================================================== --- docs/CMakeLists.txt +++ docs/CMakeLists.txt @@ -16,7 +16,6 @@ ) endif(DOXYGEN_FOUND) -find_package(PythonInterp REQUIRED) find_program(EPYDOC_EXECUTABLE NAMES epydoc epydoc.py) if(EPYDOC_EXECUTABLE) find_program(DOT_EXECUTABLE dot) Index: scripts/CMakeLists.txt =================================================================== --- scripts/CMakeLists.txt +++ scripts/CMakeLists.txt @@ -9,8 +9,6 @@ ${LLDB_SOURCE_DIR}/include/lldb/lldb-versioning.h ) -include(FindPythonInterp) - if(LLDB_BUILD_FRAMEWORK) set(framework_arg --framework --target-platform Darwin) endif() Index: scripts/Python/modules/readline/CMakeLists.txt =================================================================== --- scripts/Python/modules/readline/CMakeLists.txt +++ scripts/Python/modules/readline/CMakeLists.txt @@ -1,7 +1,4 @@ -# FIXME: if a non-standard version of python is requested, the cmake macro -# below will need Python_ADDITIONAL_VERSIONS set in order to find it. -include(FindPythonInterp) -SET(PYTHON_DIRECTORY python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages) +set(PYTHON_DIRECTORY python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages) # Build the readline python module include_directories(${PYTHON_INCLUDE_DIR})