From 4bb12494f5d9ac5cce27bf2d68722f81ee90e9fa Mon Sep 17 00:00:00 2001 From: iThorgrim <125808072+iThorgrim@users.noreply.github.com> Date: Thu, 28 Aug 2025 19:26:56 +0200 Subject: [PATCH] fix(LuaLib): Fix compilation with lua5.1 (#291) --- CMakeLists.txt | 4 ---- src/lualib/luajit/CMakeLists.txt | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 00b9b25..41b59b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,10 +16,6 @@ endif() if (LUA_VERSION MATCHES "luajit") add_subdirectory(src/lualib/luajit) - set(LUAJIT_VERSION true) else() add_subdirectory(src/lualib/lua) - set(LUAJIT_VERSION false) endif() - -set_target_properties(lualib PROPERTIES INTERFACE_COMPILE_DEFINITIONS LUAJIT_VERSION) diff --git a/src/lualib/luajit/CMakeLists.txt b/src/lualib/luajit/CMakeLists.txt index f0b184e..1530f3e 100644 --- a/src/lualib/luajit/CMakeLists.txt +++ b/src/lualib/luajit/CMakeLists.txt @@ -60,6 +60,7 @@ if (WIN32) PROPERTIES IMPORTED_LOCATION ${LUA_BIN_FOLDER}/src/lua51.lib INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src" + INTERFACE_COMPILE_DEFINITIONS "LUAJIT_VERSION=1" ) # install generated files @@ -92,6 +93,7 @@ if (WIN32) IMPORTED_LOCATION ${LUA_BIN_FOLDER}/src/lua51.dll IMPORTED_IMPLIB ${LUA_BIN_FOLDER}/src/lua51.lib INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src" + INTERFACE_COMPILE_DEFINITIONS "LUAJIT_VERSION=1" ) # install generated files @@ -147,6 +149,7 @@ if (UNIX OR APPLE) PROPERTIES # IMPORTED_LOCATION ${LUAJIT_LIB_PATH} # cmake bullshit. spent days figuring this and turns out set_target_properties does squat shit while set_property works fine. INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src" + INTERFACE_COMPILE_DEFINITIONS "LUAJIT_VERSION=1" ) set_property(TARGET lualib PROPERTY IMPORTED_LOCATION ${LUAJIT_LIB_PATH}) @@ -154,3 +157,4 @@ if (UNIX OR APPLE) install(DIRECTORY ${LUA_INSTALL_PATH}/ DESTINATION ${CMAKE_INSTALL_PREFIX}) endif() +