1
0

Made cmake compilation possible on Windows.

This commit is contained in:
madmaxoft
2013-12-27 11:51:08 +01:00
parent 2560fb40c6
commit 1cf6502be2
8 changed files with 73 additions and 36 deletions

View File

@@ -8,12 +8,23 @@ file(GLOB SOURCE
"src/*.c"
)
if(${STATIC_LUA})
add_library(lua ${SOURCE})
else()
add_library(lua SHARED ${SOURCE})
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()
if(UNIX)
target_link_libraries(lua m dl)
# Lua needs to be linked dynamically on Windows and statically on *nix, so that LuaRocks work
if (WIN32)
add_library(lua SHARED ${SOURCE})
else()
add_library(lua ${SOURCE})
endif()
if (UNIX)
target_link_libraries(m dl)
endif()