1
0
cuberite-2a/lib/lua/CMakeLists.txt

48 lines
1.3 KiB
CMake
Raw Normal View History

2013-12-18 18:14:11 -05:00
cmake_minimum_required (VERSION 2.6)
project (lua)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
file(GLOB SOURCE
2013-12-18 18:54:55 -05:00
"src/*.c"
2013-12-18 18:14:11 -05:00
)
list(REMOVE_ITEM SOURCE "${PROJECT_SOURCE_DIR}/src/lua.c" "${PROJECT_SOURCE_DIR}/src/luac.c")
# add headers to MSVC project files:
if (WIN32)
file(GLOB HEADERS "src/*.h")
list(REMOVE_ITEM SOURCE "${PROJECT_SOURCE_DIR}/src/lua.h" "${PROJECT_SOURCE_DIR}/src/luac.h")
set(SOURCE ${SOURCE} ${HEADERS})
source_group("Sources" FILES ${SOURCE})
endif()
# Lua needs to be linked dynamically on Windows and statically on *nix, so that LuaRocks work
if (WIN32)
add_library(lua SHARED ${SOURCE})
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/MCServer)
if (MSVC)
# MSVC generator adds a "Debug" or "Release" postfixes to the LIBRARY_OUTPUT_PATH, we need to cancel them:
SET_TARGET_PROPERTIES(lua PROPERTIES PREFIX "../")
SET_TARGET_PROPERTIES(lua PROPERTIES IMPORT_PREFIX "../")
# Remove SCL warnings, we expect this library to have been tested safe
SET_TARGET_PROPERTIES(
lua PROPERTIES COMPILE_FLAGS "-D_CRT_SECURE_NO_WARNINGS"
)
endif()
else()
add_library(lua ${SOURCE})
endif()
2013-12-18 18:14:11 -05:00
# Tell Lua what dynamic loader to use (for LuaRocks):
if (UNIX)
add_definitions(-DLUA_USE_DLOPEN)
endif()
if (UNIX)
2014-01-07 08:08:58 -05:00
target_link_libraries(lua m ${DYNAMIC_LOADER})
2013-12-21 08:50:32 -05:00
endif()