# Copyright (C) 2007-2009 LuaDist. # Created by Peter Kapec # Redistribution and use of this file is allowed according to the terms of the MIT license. # For details see the COPYRIGHT file distributed with LuaDist. # Please note that the package source code is licensed under its own license. PROJECT(luasys C) # CMake configuration: CMAKE_MINIMUM_REQUIRED(VERSION 2.6 ) # Where to install module parts: SET (INSTALL_CMOD share/lua/cmod CACHE PATH "Directory to install Lua binary modules.") SET (INSTALL_DATA . CACHE PATH "Directory the package can store documentation, tests or other data in.") SET (INSTALL_TEST ${INSTALL_DATA}/test CACHE PATH "Recommended directory to install tests into.") # We need Lua to compile FIND_PACKAGE (Lua51 REQUIRED) INCLUDE_DIRECTORIES( ${LUA_INCLUDE_DIR}) # Build INCLUDE_DIRECTORIES(src src/event) IF(WIN32 AND NOT CYGWIN) ADD_DEFINITIONS(-DWIN32) SET(WIN32_SRC src/win32/sys_win32.c ) SET(LIBS winmm ws2_32 mswsock) ELSEIF(UNIX) SET(LIBS pthread) ENDIF(WIN32 AND NOT CYGWIN) ADD_LIBRARY(sys MODULE src/luasys.c src/thread/sys_thread.c src/sock/sys_sock.c src/mem/sys_mem.c src/event/evq.c src/event/timeout.c ${WIN32_SRC}) TARGET_LINK_LIBRARIES(sys ${LUA_LIBRARY} ${LIBS}) SET_TARGET_PROPERTIES(sys PROPERTIES PREFIX "") # Install all files and documentation INSTALL (TARGETS sys DESTINATION ${INSTALL_CMOD}) INSTALL (FILES README VERSION DESTINATION ${INSTALL_DATA}) INSTALL (DIRECTORY test/ DESTINATION ${INSTALL_TEST})