llvm-project/lldb/cmake/modules/FindLuaAndSwig.cmake
Jonas Devlieghere e19d740169
[lldb] Support both Lua 5.3 and Lua 5.4 (#115500)
Lua 5.3 and Lua 5.4 are similar enough that we can easily support both
in LLDB. This patch adds support for building LLDB with both and updates
the documentation accordingly.
2024-11-11 08:11:03 -08:00

43 lines
1.2 KiB
CMake

#.rst:
# FindLuaAndSwig
# --------------
#
# Find Lua and SWIG as a whole.
if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND LLDB_ENABLE_SWIG)
set(LUAANDSWIG_FOUND TRUE)
else()
if (LLDB_ENABLE_SWIG)
find_package(Lua 5.3)
if(LUA_FOUND)
# Find the Lua executable. Only required to run a subset of the Lua
# tests.
find_program(LUA_EXECUTABLE
NAMES
"lua"
"lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}"
)
mark_as_advanced(
LUA_LIBRARIES
LUA_INCLUDE_DIR
LUA_VERSION_MINOR
LUA_VERSION_MAJOR
LUA_EXECUTABLE)
endif()
else()
message(STATUS "SWIG 4 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
LUA_VERSION_MINOR
LUA_VERSION_MAJOR
LLDB_ENABLE_SWIG)
endif()