From 58316c608d4091a5849abfee2cb7f58eba7af52d Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Thu, 6 Oct 2016 01:16:57 +0200 Subject: [PATCH] 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. --- cmake/FindLuabind.cmake | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cmake/FindLuabind.cmake b/cmake/FindLuabind.cmake index cb4719132..368e9c02f 100644 --- a/cmake/FindLuabind.cmake +++ b/cmake/FindLuabind.cmake @@ -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