Skip to content

Commit e452fe3

Browse files
authored
fix: Fix warning from Luajit
1 parent b5a461b commit e452fe3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lualib/luajit/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929

3030
project ( lua C )
3131

32+
# Remove -Werror from flags for LuaJIT compilation
33+
string(REGEX REPLACE "-Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
34+
string(REGEX REPLACE "-Werror" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
35+
# Also remove any warning-as-error flags
36+
string(REGEX REPLACE "-Wno-error=[^ ]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
37+
string(REGEX REPLACE "-Wno-error=[^ ]*" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
38+
3239
# Download source
3340
include(FetchContent)
3441
FetchContent_Declare(
@@ -129,7 +136,7 @@ if (UNIX OR APPLE)
129136
add_custom_command(
130137
OUTPUT ${LUAJIT_LIB_PATH}
131138
# COMMAND $(MAKE) -C ${LUA_BIN_FOLDER} PREFIX=${LUA_INSTALL_PATH}
132-
COMMAND $(MAKE) -C ${LUA_BIN_FOLDER} install PREFIX=${LUA_INSTALL_PATH}
139+
COMMAND $(MAKE) -C ${LUA_BIN_FOLDER} install PREFIX=${LUA_INSTALL_PATH} "CFLAGS=-O2 -fomit-frame-pointer -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int"
133140
)
134141
# endif()
135142
add_custom_target(luajit_target DEPENDS ${LUAJIT_LIB_PATH})

0 commit comments

Comments
 (0)