build/macOS: set -fno-stack-check for LuaJIT build #11412

Fixes LuaJIT build on macOS Catalina.
ref https://github.com/LuaJIT/LuaJIT/issues/521
ref https://github.com/Homebrew/homebrew-core/pull/46823
This commit is contained in:
Christian Clason 2019-11-17 21:55:25 +01:00 committed by Justin M. Keyes
parent 97f1222005
commit 1f0fc4e452
1 changed files with 7 additions and 0 deletions

View File

@ -42,6 +42,12 @@ function(BuildLuajit)
endif()
endfunction()
check_c_compiler_flag(-fno-stack-check HAS_NO_STACK_CHECK)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND HAS_NO_STACK_CHECK)
set(NO_STACK_CHECK "CFLAGS+=-fno-stack-check")
else()
set(NO_STACK_CHECK "")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
set(AMD64_ABI "LDFLAGS=-lpthread -lc++abi")
else()
@ -50,6 +56,7 @@ endif()
set(INSTALLCMD_UNIX ${MAKE_PRG} CFLAGS=-fPIC
CFLAGS+=-DLUA_USE_APICHECK
CFLAGS+=-DLUA_USE_ASSERT
${NO_STACK_CHECK}
${AMD64_ABI}
CCDEBUG+=-g
Q=