Skip to content

Commit

Permalink
[lldb/CMake] Only auto-enable Lua when SWIG is found
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JDevlieghere committed Jan 8, 2020
1 parent 2d258ed commit edadb81
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions lldb/cmake/modules/FindLuaAndSwig.cmake
Original file line number Diff line number Diff line change
@@ -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()
2 changes: 1 addition & 1 deletion lldb/cmake/modules/LLDBConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit edadb81

Please sign in to comment.