blob: 864f2235bc94ed549b8862f653aa6f1ce3b77a96 (
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
44
45
46
47
|
#
find_program(MAKE_EXE NAMES gmake nmake make)
include(ExternalProject)
message(DEBUG "Compiler: ${CMAKE_C_COMPILER} Ar: ${CMAKE_AR} Ranlib: ${CMAKE_RANLIB}")
set(_staging_dir "${CMAKE_BINARY_DIR}/staging")
if(MINGW)
set(_target mingw)
elseif(APPLE)
set(_target macosx)
elseif(CMAKE_SYSTEM_NAME MATCHES Linux)
set(_target linux)
elseif(UNIX)
set(_target posix)
else()
set(_target generic)
endif()
set(HAVE_LUA TRUE)
set(LUA_INCLUDE_DIRS "${_staging_dir}/include")
set(LUA_LIBRARIES "${_staging_dir}/lib/liblua.a")
set(LUA_FOUND TRUE CACHE INTERNAL "")
set(Lua_FOUND TRUE CACHE INTERNAL "")
set(_lua52_cflags "-fPIC")
if(APPLE)
set(_lua52_cflags "${lua52_cflags} -isysroot ${CMAKE_OSX_SYSROOT}")
endif()
#
# The install patch isn't strictly necessary for Lua but it's cleaner to install
# external projects to a staging directory first, and the normal install target
# does not work with MinGW.
#
ExternalProject_Add(lua52
URL https://gitlab.com/wireshark/wireshark-development-libraries/-/raw/main/public/src/lua/lua-5.2.4.tar.gz
URL https://www.lua.org/ftp/lua-5.2.4.tar.gz
URL_HASH SHA256=b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/0001-Add-an-install-static-target.patch
CONFIGURE_COMMAND ""
BUILD_COMMAND ${MAKE_EXE} MYCFLAGS=${_lua52_cflags} CC=${CMAKE_C_COMPILER} AR=${CMAKE_AR}\ rcu RANLIB=${CMAKE_RANLIB} ${_target}
BUILD_IN_SOURCE True
BUILD_BYPRODUCTS ${LUA_LIBRARIES}
INSTALL_COMMAND ${MAKE_EXE} INSTALL_TOP=${_staging_dir} install-static
)
|