Fix verison detection for multiple lua installations

If both lua 5.3 and lua 5.2 are installed the old code threw an error
that 5.2 was not found since FindLua always picks the neweste version.
This commit is contained in:
Patrick Niklaus 2016-10-06 01:16:57 +02:00 committed by Patrick Niklaus
parent 1c2ead8fb8
commit 58316c608d

View File

@ -4,12 +4,16 @@
# LUABIND_LIBRARIES
# LUABIND_INCLUDE_DIR, where to find luabind.hpp
FIND_PACKAGE(Lua REQUIRED)
IF ("${LUA_VERSION_MAJOR}" STREQUAL "5" AND
("${LUA_VERSION_MINOR}" STREQUAL "1" OR "${LUA_VERSION_MINOR}" STREQUAL "2"))
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
FIND_PACKAGE(Lua 5.2 EXACT)
IF (LUA_FOUND)
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
ELSE()
MESSAGE(FATAL_ERROR "Lua ${LUA_VERSION_STRING} detected; need 5.1 or 5.2")
FIND_PACKAGE(Lua 5.1 EXACT)
IF (LUA_FOUND)
MESSAGE(STATUS "Using Lua ${LUA_VERSION_STRING}")
ELSE()
MESSAGE(FATAL_ERROR "Lua 5.1 or 5.2 was not found.")
ENDIF()
ENDIF()
FIND_PATH(LUABIND_INCLUDE_DIR luabind.hpp