build: enforce PREFER_LUA

Only search for luajit if PREFER_LUA=OFF. If PREFER_LUA is OFF, then
always prioritize luajit first and then fall back to lua.
This commit is contained in:
dundargoc 2023-11-12 22:04:15 +01:00 committed by dundargoc
parent 6d14f3ddab
commit 03c3f7887d

View File

@ -168,7 +168,10 @@ foreach(CFGNAME ${CMAKE_CONFIGURATION_TYPES})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFGNAME} ${CMAKE_BINARY_DIR}/lib)
endforeach()
find_program(LUA_PRG NAMES luajit lua5.1 lua5.2 lua)
if(NOT PREFER_LUA)
find_program(LUA_PRG NAMES luajit)
endif()
find_program(LUA_PRG NAMES lua5.1 lua5.2 lua)
if(NOT LUA_PRG)
message(FATAL_ERROR "Failed to find a Lua 5.1-compatible interpreter")
endif()