diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 20b4aa809e55..b8b047b87920 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -135,10 +135,10 @@ function(find_python_libs_windows) return() endif() - file(TO_CMAKE_PATH "${PYTHON_HOME}/Include" PYTHON_INCLUDE_DIRS) + file(TO_CMAKE_PATH "${PYTHON_HOME}/Include" PYTHON_INCLUDE_DIR) - if(EXISTS "${PYTHON_INCLUDE_DIRS}/patchlevel.h") - file(STRINGS "${PYTHON_INCLUDE_DIRS}/patchlevel.h" python_version_str + if(EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") + file(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" python_version_str REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"") string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"+]+)[+]?\".*" "\\1" PYTHONLIBS_VERSION_STRING "${python_version_str}") @@ -146,7 +146,7 @@ function(find_python_libs_windows) string(REGEX REPLACE "([0-9]+)[.]([0-9]+)[.][0-9]+" "python\\1\\2" PYTHONLIBS_BASE_NAME "${PYTHONLIBS_VERSION_STRING}") unset(python_version_str) else() - message("Unable to find ${PYTHON_INCLUDE_DIRS}/patchlevel.h, Python installation is corrupt.") + message("Unable to find ${PYTHON_INCLUDE_DIR}/patchlevel.h, Python installation is corrupt.") message("Python support will be disabled for this build.") set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE) return() @@ -225,12 +225,12 @@ function(find_python_libs_windows) set (PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} PARENT_SCOPE) set (PYTHON_LIBRARY ${PYTHON_LIBRARY} PARENT_SCOPE) set (PYTHON_DLL ${PYTHON_DLL} PARENT_SCOPE) - set (PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} PARENT_SCOPE) + set (PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR} PARENT_SCOPE) message("-- LLDB Found PythonExecutable: ${PYTHON_RELEASE_EXE} and ${PYTHON_DEBUG_EXE}") message("-- LLDB Found PythonLibs: ${PYTHON_RELEASE_LIB} and ${PYTHON_DEBUG_LIB}") message("-- LLDB Found PythonDLL: ${PYTHON_RELEASE_DLL} and ${PYTHON_DEBUG_DLL}") - message("-- LLDB Found PythonIncludeDirs: ${PYTHON_INCLUDE_DIRS}") + message("-- LLDB Found PythonIncludeDirs: ${PYTHON_INCLUDE_DIR}") endfunction(find_python_libs_windows) if (NOT LLDB_DISABLE_PYTHON) @@ -243,17 +243,19 @@ if (NOT LLDB_DISABLE_PYTHON) add_definitions( -DLLDB_PYTHON_HOME="${LLDB_PYTHON_HOME}" ) endif() else() - find_package(PythonLibs REQUIRED) + find_package(PythonInterp) + find_package(PythonLibs) endif() - - if (PYTHON_INCLUDE_DIRS) - include_directories(${PYTHON_INCLUDE_DIRS}) + + if (PYTHON_INCLUDE_DIR) + include_directories(${PYTHON_INCLUDE_DIR}) endif() endif() if (LLDB_DISABLE_PYTHON) - unset(PYTHON_INCLUDE_DIRS) + unset(PYTHON_INCLUDE_DIR) unset(PYTHON_LIBRARY) + unset(PYTHON_EXECUTABLE) add_definitions( -DLLDB_DISABLE_PYTHON ) endif() diff --git a/lldb/scripts/CMakeLists.txt b/lldb/scripts/CMakeLists.txt index 7dec75bb1374..b394be3da111 100644 --- a/lldb/scripts/CMakeLists.txt +++ b/lldb/scripts/CMakeLists.txt @@ -9,8 +9,6 @@ set(SWIG_HEADERS ${LLDB_SOURCE_DIR}/include/lldb/lldb-versioning.h ) -include(FindPythonInterp) - if(LLDB_BUILD_FRAMEWORK) set(framework_arg --framework --target-platform Darwin) endif() diff --git a/lldb/source/Utility/CMakeLists.txt b/lldb/source/Utility/CMakeLists.txt index 254fb41b76d6..280ed3ccb59c 100644 --- a/lldb/source/Utility/CMakeLists.txt +++ b/lldb/source/Utility/CMakeLists.txt @@ -27,7 +27,7 @@ if(Backtrace_FOUND) endif() if (NOT LLDB_DISABLE_PYTHON AND NOT LLVM_BUILD_STATIC) - list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES}) + list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARY}) endif() list(APPEND LLDB_SYSTEM_LIBS ${system_libs})