Files
itgmania212121/extern/CMakeProject-lua.cmake
T
Prcuvu 123b01930e Force Lua to be compiled as C++ code when using MSVC
The setjmp/longjmp error handling mechanism may fail with Microsoft C++ since
they utilize the same stack-unwinding mechanism with C++ exception handling.
Lua calling longjmp after luaD_rawrunprotected returns causes unpredictable
behaviour. On Windows x64 build, this causes lua_error to crash the whole
StepMania program.

Lua provides the same macros to utilize C++ throw/catch, which effectively
solve the problem. Just specify Lua library as C++ code to enable them.

Reference: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/longjmp
2019-12-22 18:38:07 +08:00

71 lines
1.7 KiB
CMake

set(LUA_SRC
"lua-5.1/src/lapi.c"
"lua-5.1/src/lauxlib.c"
"lua-5.1/src/lbaselib.c"
"lua-5.1/src/lcode.c"
"lua-5.1/src/ldblib.c"
"lua-5.1/src/ldebug.c"
"lua-5.1/src/ldo.c"
"lua-5.1/src/ldump.c"
"lua-5.1/src/lfunc.c"
"lua-5.1/src/lgc.c"
"lua-5.1/src/linit.c"
"lua-5.1/src/liolib.c"
"lua-5.1/src/llex.c"
"lua-5.1/src/lmathlib.c"
"lua-5.1/src/lmem.c"
"lua-5.1/src/loadlib.c"
"lua-5.1/src/lobject.c"
"lua-5.1/src/lopcodes.c"
"lua-5.1/src/loslib.c"
"lua-5.1/src/lparser.c"
"lua-5.1/src/lstate.c"
"lua-5.1/src/lstring.c"
"lua-5.1/src/lstrlib.c"
"lua-5.1/src/ltable.c"
"lua-5.1/src/ltablib.c"
"lua-5.1/src/ltm.c"
"lua-5.1/src/lundump.c"
"lua-5.1/src/lvm.c"
"lua-5.1/src/lzio.c")
set(LUA_HPP
"lua-5.1/src/lapi.h"
"lua-5.1/src/lauxlib.h"
"lua-5.1/src/lcode.h"
"lua-5.1/src/ldebug.h"
"lua-5.1/src/lfunc.h"
"lua-5.1/src/lgc.h"
"lua-5.1/src/llex.h"
"lua-5.1/src/llimits.h"
"lua-5.1/src/lmem.h"
"lua-5.1/src/lobject.h"
"lua-5.1/src/lopcodes.h"
"lua-5.1/src/lparser.h"
"lua-5.1/src/lstate.h"
"lua-5.1/src/lstring.h"
"lua-5.1/src/ltable.h"
"lua-5.1/src/ltm.h"
"lua-5.1/src/lua.h"
"lua-5.1/src/luaconf.h"
"lua-5.1/src/lualib.h"
"lua-5.1/src/lundump.h"
"lua-5.1/src/lvm.h"
"lua-5.1/src/lzio.h")
source_group("" FILES ${LUA_SRC})
source_group("" FILES ${LUA_HPP})
add_library("lua-5.1" STATIC ${LUA_SRC} ${LUA_HPP})
set_property(TARGET "lua-5.1" PROPERTY FOLDER "External Libraries")
# include_directories(src)
if(MSVC)
sm_add_compile_definition("lua-5.1" _CRT_SECURE_NO_WARNINGS)
sm_add_compile_flag("lua-5.1" /TP)
endif(MSVC)
disable_project_warnings("lua-5.1")