summaryrefslogtreecommitdiff
path: root/lldb/cmake/modules/FindLuaAndSwig.cmake
blob: c5df29e8d0a92d4938948213c2705f46c44fcad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#.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_EXECUTABLE
                                      LUA_LIBRARIES
                                      LUA_INCLUDE_DIR
                                      LUA_VERSION_MINOR
                                      LUA_VERSION_MAJOR
                                      LLDB_ENABLE_SWIG)
endif()