build: macos: Specify MACOSX_DEPLOYMENT_TARGET explicitly
On LuaJIT, it requests to specify MACOSX_DEPLOYMENT_TARGET explicitly on
build command arguments.
@@ -12,7 +12,15 @@ set(LUAJIT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${FLB_PATH_LIB_LUAJIT})
set(LUAJIT_DEST ${CMAKE_CURRENT_BINARY_DIR})
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
- set(CFLAGS "${CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
+ set(CFLAGS "${CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT} -fno-stack-check")
+ if (CMAKE_HOST_SYSTEM_VERSION VERSION_GREATER_EQUAL 20
+ AND CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 21)
+ set(DEPLOYMENT_TARGET "MACOSX_DEPLOYMENT_TARGET=11.0")
+ else()
+ set(DEPLOYMENT_TARGET "MACOSX_DEPLOYMENT_TARGET=10.15")
+ endif()
+else()
+ set(DEPLOYMENT_TARGET "")
endif()
# luajit (UNIX)
@@ -22,7 +30,7 @@ ExternalProject_Add(luajit
EXCLUDE_FROM_ALL TRUE
SOURCE_DIR ${LUAJIT_SRC}
CONFIGURE_COMMAND ./configure
- BUILD_COMMAND $(MAKE) CROSS=${CROSS_PREFIX} CFLAGS=${CFLAGS} BUILD_MODE=static "XCFLAGS=-fPIC"
+ BUILD_COMMAND $(MAKE) CROSS=${CROSS_PREFIX} CFLAGS=${CFLAGS} BUILD_MODE=static "XCFLAGS=-fPIC" ${DEPLOYMENT_TARGET}
INSTALL_COMMAND cp src/libluajit.a "${LUAJIT_DEST}/lib/libluajit.a")
# luajit (Windows)
