source: trunk/debian/packages/libubox/trunk/lua/CMakeLists.txt @ 857

Last change on this file since 857 was 857, checked in by amain, 4 years ago

libubox: initial import / part 4

File size: 1.1 KB
Line 
1cmake_minimum_required(VERSION 2.6)
2
3PROJECT(uloop C)
4
5SET(CMAKE_INSTALL_PREFIX /)
6
7IF(NOT LUA_CFLAGS)
8        pkg_search_module(LUA lua5.1 lua-5.1)
9ENDIF()
10
11ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -I.. ${LUA_CFLAGS})
12LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
13
14IF(APPLE)
15        SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -undefined dynamic_lookup")
16ENDIF(APPLE)
17
18IF(NOT LUAPATH)
19        EXECUTE_PROCESS(
20                COMMAND  lua -e "for k in string.gmatch(package.cpath .. \";\", \"([^;]+)/..so;\") do if k:sub(1,1) == \"/\" then print(k) break end end"
21                OUTPUT_VARIABLE LUAPATH
22                RESULT_VARIABLE LUA_CHECK_RES
23                OUTPUT_STRIP_TRAILING_WHITESPACE
24        )
25
26        IF(BUILD_LUA)
27                IF(NOT ${LUA_CHECK_RES} EQUAL 0 OR "${LUAPATH}" EQUAL "")
28                        MESSAGE(SEND_ERROR "Lua was not found on your system")
29                ENDIF()
30        ENDIF()
31ENDIF()
32
33IF(BUILD_LUA)
34        ADD_LIBRARY(uloop_lua MODULE uloop.c)
35        SET_TARGET_PROPERTIES(uloop_lua PROPERTIES
36                OUTPUT_NAME uloop
37                PREFIX ""
38        )
39        TARGET_LINK_LIBRARIES(uloop_lua ubox)
40
41        INSTALL(TARGETS uloop_lua
42                LIBRARY DESTINATION ${LUAPATH}
43        )
44ENDIF()
Note: See TracBrowser for help on using the repository browser.