From 0710f15c05428f625ba8be0448f1250a35afa299 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 3 Mar 2016 20:50:20 +0100 Subject: [PATCH] Lua 5.3 support for Fedora 22+, fixes #262 --- code/CMakeModules/FindLuabind.cmake | 68 ++++++++++++++++++----------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index 6795a5089..e98c84f54 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -9,38 +9,56 @@ MACRO(FIND_CORRECT_LUA_VERSION) IF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") INCLUDE(CheckDepends) - SET(LUA52_LIBRARY "liblua5.2") - CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) - + # check for Lua 5.3 + SET(LUA53_LIBRARY "liblua5.3") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA53_LIBRARY LUALIB_FOUND) + IF(NOT LUALIB_FOUND) - # fedora (v20) - SET(LUA52_LIBRARY "liblua-5.2") - CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) - ENDIF(NOT LUALIB_FOUND) + # fedora (v22+) + SET(LUA53_LIBRARY "liblua-5.3") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA53_LIBRARY LUALIB_FOUND) + ENDIF() IF(LUALIB_FOUND) - MESSAGE(STATUS "Luabind is using Lua 5.2") - FIND_PACKAGE(Lua52 REQUIRED) - ELSE(LUALIB_FOUND) - SET(LUA51_LIBRARY "liblua5.1") - CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.3") + FIND_PACKAGE(Lua53 REQUIRED) + ELSE() + # check for Lua 5.2 + SET(LUA52_LIBRARY "liblua5.2") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) + + IF(NOT LUALIB_FOUND) + # fedora (v20) + SET(LUA52_LIBRARY "liblua-5.2") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) + ENDIF() IF(LUALIB_FOUND) - MESSAGE(STATUS "Luabind is using Lua 5.1") - FIND_PACKAGE(Lua51 REQUIRED) - ELSE(LUALIB_FOUND) - SET(LUA50_LIBRARY "liblua5.0") - CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.2") + FIND_PACKAGE(Lua52 REQUIRED) + ELSE() + # check for Lua 5.1 + SET(LUA51_LIBRARY "liblua5.1") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND) IF(LUALIB_FOUND) - MESSAGE(STATUS "Luabind is using Lua 5.0") - FIND_PACKAGE(Lua50 REQUIRED) - ELSE(LUALIB_FOUND) - MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind") - ENDIF(LUALIB_FOUND) - ENDIF(LUALIB_FOUND) - ENDIF(LUALIB_FOUND) - ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") + MESSAGE(STATUS "Luabind is using Lua 5.1") + FIND_PACKAGE(Lua51 REQUIRED) + ELSE() + # check for Lua 5.0 + SET(LUA50_LIBRARY "liblua5.0") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND) + + IF(LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.0") + FIND_PACKAGE(Lua50 REQUIRED) + ELSE() + MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind") + ENDIF() + ENDIF() + ENDIF() + ENDIF() + ELSE() # TODO: find a way to detect Lua version IF(WITH_LUA53) FIND_PACKAGE(Lua53 REQUIRED)