use separate slot implementation for each module
[lqt.git] / lua / CMakeLists.txt
blob966b9a4c5a7dcbc74079aad37433bd1be578f2e0
2 project (LUA C)
4 set(LUA_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lua/src)
6 # the following two variables are defined for the use of packages 
7 # that wish to link or compile against lua
8 set (LUA_INCLUDE_DIRS "${LUA_SRC_DIR}")
9 set (LUA_LIBRARIES lua)
12 macro(add_prefix _list _prefix)
13         set(_tmp)
14         foreach(_current ${${_list}})
15                 set(_tmp ${_tmp} ${_prefix}/${_current})
16                 #message( ${_prefix}/${_current})
17         endforeach()
18         set(${_list} ${_tmp})
19 endmacro()
22 # define the lua core source files
23 set (LUA_CORE_SRCS lapi.c lcode.c ldebug.c ldo.c ldump.c 
24          lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c
25          lparser.c lstate.c lstring.c ltable.c ltm.c  lundump.c
26          lvm.c lzio.c)
27 add_prefix(LUA_CORE_SRCS ${LUA_SRC_DIR}/)
29 # define the lua lib source files
30 set (LUA_LIB_SRCS lauxlib.c lbaselib.c ldblib.c liolib.c
31         lmathlib.c loslib.c ltablib.c lstrlib.c loadlib.c linit.c)
32 add_prefix(LUA_LIB_SRCS ${LUA_SRC_DIR}/)
34 # create the library
35 if(WIN32)
36         add_definitions(-DLUA_BUILD_AS_DLL)
37         if(MSVC)
38                 add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
39         endif()
40 else()
41         add_definitions(-DLUA_USE_LINUX)
42 endif()
43 set(LIBRARY_TYPE SHARED)
46 add_library (lua ${LIBRARY_TYPE} ${LUA_LIB_SRCS} ${LUA_CORE_SRCS})
48 if(UNIX)
49         target_link_libraries (lua readline)
50         if(NOT APPLE)
51                 target_link_libraries (lua dl m history ncurses)
52         endif()
53 endif()
55 # create the lue executable and link it to the lib
56 add_executable (luaexec ${LUA_SRC_DIR}/lua.c)
57 target_link_libraries (luaexec lua)
59 # name the executable lua just like the library
60 set_target_properties(luaexec PROPERTIES OUTPUT_NAME lua)
62 # create the luac thing (I have no clue) and link it
63 #add_executable (luac ${LUA_SRC_DIR}/luac.c ${LUA_SRC_DIR}/print.c)
64 #target_link_libraries (luac lua)