[lldb/CMake] Only auto-enable Lua when SWIG is found

Just like Python, Lua should only be auto-enabled if SWIG is found as
well. This moves the logic of finding SWIG and Lua as a whole into a new
CMake package.
This commit is contained in:
Jonas Devlieghere 2020-01-08 14:01:57 -08:00
parent 2d258ed931
commit edadb818e5
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,31 @@
#.rst:
# FindLuaAndSwig
# --------------
#
# Find Lua and SWIG as a whole.
if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
set(LUAANDSWIG_FOUND TRUE)
else()
find_package(SWIG 2.0 QUIET)
if (SWIG_FOUND)
find_package(Lua QUIET)
if(LUA_FOUND AND SWIG_FOUND)
mark_as_advanced(
LUA_LIBRARIES
LUA_INCLUDE_DIR
SWIG_EXECUTABLE)
endif()
else()
message(STATUS "SWIG 2 or later is required for Lua support in LLDB but could not be found")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LuaAndSwig
FOUND_VAR
LUAANDSWIG_FOUND
REQUIRED_VARS
LUA_LIBRARIES
LUA_INCLUDE_DIR
SWIG_EXECUTABLE)
endif()

View File

@ -56,7 +56,7 @@ endmacro()
add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)
add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" Lua LUA_FOUND)
add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" LuaAndSwig LUAANDSWIG_FOUND)
add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in LLDB" PythonInterpAndLibs PYTHONINTERPANDLIBS_FOUND)
add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" LibXml2 LIBXML2_FOUND VERSION 2.8)