diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -267,10 +267,15 @@ message(STATUS "LLDB Found PythonIncludeDirs: ${PYTHON_INCLUDE_DIR}") endfunction(find_python_libs_windows) +# Call find_python_libs_windows ahead of the rest of the python configuration. +# It's possible that it won't find a python installation and will then set +# LLDB_DISABLE_PYTHON to ON. +if (NOT LLDB_DISABLE_PYTHON AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + find_python_libs_windows() +endif() + if (NOT LLDB_DISABLE_PYTHON) if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") - find_python_libs_windows() - if (NOT LLDB_RELOCATABLE_PYTHON) file(TO_CMAKE_PATH "${PYTHON_HOME}" LLDB_PYTHON_HOME) add_definitions( -DLLDB_PYTHON_HOME="${LLDB_PYTHON_HOME}" )