-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
36 lines (25 loc) · 1.09 KB
/
CMakeLists.txt
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
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
PROJECT(lua-openbsd)
FIND_PACKAGE(PkgConfig)
INCLUDE(CheckFunctionExists)
SET(MODLUA_VERSION "5.1" CACHE STRING "MODLUA_VERSION from ports tree.")
STRING(REPLACE "." "" LUA_PKGCONFIG_VERSION ${MODLUA_VERSION})
PKG_CHECK_MODULES(LUA REQUIRED "lua${LUA_PKGCONFIG_VERSION}")
ADD_DEFINITIONS("-Wall -Werror")
CHECK_FUNCTION_EXISTS("pledge" HAVE_PLEDGE)
CHECK_FUNCTION_EXISTS("arc4random" HAVE_ARC4RANDOM)
CHECK_FUNCTION_EXISTS("arc4random_uniform" HAVE_ARC4RANDOM_UNIFORM)
CHECK_FUNCTION_EXISTS("unveil" HAVE_UNVEIL)
CHECK_FUNCTION_EXISTS("auth_userokay" HAVE_AUTH_USEROKAY)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/config.h.in"
"${CMAKE_BINARY_DIR}/config.h")
SET(SOURCES "src/lua-openbsd.c")
SET(HEADERS "${CMAKE_BINARY_DIR}/config.h")
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}
${LUA_INCLUDE_DIRS})
SET(TARGET "openbsd")
ADD_LIBRARY(${TARGET} SHARED ${SOURCES} ${HEADERS})
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(${TARGET} ${LUA_LIBRARIES} ${LUA_LDFLAGS})
INSTALL(TARGETS ${TARGET}
DESTINATION /usr/local/lib/lua/${MODLUA_VERSION}/)