Skip to content

Commit 2c32e92

Browse files
Merge pull request #11155 from swiftlang/jepa-stable2
[LLDB][cmake] Fix build when LLDB_ENABLE_PYTHON=NO
2 parents 243871e + 9922b10 commit 2c32e92

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,19 @@ if (LLDB_ENABLE_PYTHON)
211211
set(LLDB_PYTHON_HOME "${PYTHON_HOME}" CACHE STRING
212212
"Path to use as PYTHONHOME in lldb. If a relative path is specified, it will be resolved at runtime relative to liblldb directory.")
213213
endif()
214+
else()
215+
# Even if Python scripting is disabled, we still need a Python interpreter to
216+
# build, for example to generate SBLanguages.h.
217+
find_package(Python3 COMPONENTS Interpreter REQUIRED)
218+
219+
# Remove lldb-python-scripts from distribution components.
220+
# LLVM_DISTRIBUTION_COMPONENTS is set in a cache where LLDB_ENABLE_PYTHON does
221+
# not yet have a value. We have to touch up LLVM_DISTRIBUTION_COMPONENTS after
222+
# the fact.
223+
if(LLVM_DISTRIBUTION_COMPONENTS)
224+
list(REMOVE_ITEM LLVM_DISTRIBUTION_COMPONENTS lldb-python-scripts)
225+
set(LLVM_DISTRIBUTION_COMPONENTS ${LLVM_DISTRIBUTION_COMPONENTS} CACHE STRING "" FORCE)
226+
endif()
214227
endif()
215228

216229
if (LLVM_EXTERNAL_CLANG_SOURCE_DIR)

0 commit comments

Comments
 (0)