vcpkg/ports/luasocket/CMakeLists.txt
Stephen E. Baker 1993a5eae6 LuaSocket port for vcpkg
Port is based off the last commit, as the last release version does not
work with 64 bit Windows, and there have been a number of critical bug fixes
since the last release candidate from 2013.
2017-10-29 22:21:41 -04:00

66 lines
1.4 KiB
CMake

cmake_minimum_required(VERSION 3.0.2)
project(luasocket)
if(NOT WIN32)
message(FATAL_ERROR "Written for windows only")
endif()
find_path(LUA_INCLUDE_DIR lua.h PATH_SUFFIXES lua)
find_library(LUA_LIBRARY lua)
set(LUASOCKET_INCLUDES ${LUA_INCLUDE_DIR} src)
set(LUASOCKET_LIBRARIES ${LUA_LIBRARY} ws2_32)
add_library(socket.core
src/luasocket.c
src/timeout.c
src/buffer.c
src/io.c
src/auxiliar.c
src/options.c
src/inet.c
src/except.c
src/select.c
src/tcp.c
src/udp.c
src/compat.c
src/wsocket.c)
add_library(mime.core
src/mime.c
src/compat.c)
target_include_directories(socket.core PRIVATE ${LUASOCKET_INCLUDES})
target_link_libraries(socket.core PRIVATE ${LUASOCKET_LIBRARIES})
target_include_directories(mime.core PRIVATE ${LUASOCKET_INCLUDES})
target_link_libraries(mime.core PRIVATE ${LUASOCKET_LIBRARIES})
add_definitions(
"-DLUASOCKET_API=__declspec(dllexport)"
"-DMIME_API=__declspec(dllexport)")
install(TARGETS socket.core
RUNTIME DESTINATION bin/socket
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(TARGETS mime.core
RUNTIME DESTINATION bin/mime
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES
src/ltn12.lua
src/socket.lua
src/mime.lua
DESTINATION share/lua)
install(FILES
src/http.lua
src/url.lua
src/tp.lua
src/ftp.lua
src/headers.lua
src/smtp.lua
DESTINATION share/lua/socket)