From 2759e22575b9c63f3162a9629c2d8aa6b9d7effa Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 24 Jan 2017 15:19:34 -0500 Subject: FindLua: try to find library according to version from header Patch-by: fft on gitlab.kitware.com Issue: #15756 --- Modules/FindLua.cmake | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index c777970..b59b9b3 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -75,16 +75,9 @@ function(_lua_set_version_vars) include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} ) - list(APPEND _lua_library_names - lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} - lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - ) endforeach () set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) - set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE) set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE) endfunction(_lua_set_version_vars) @@ -152,6 +145,15 @@ endif () unset(_lua_include_subdirs) unset(_lua_append_versions) +if (LUA_VERSION_STRING) + set(_lua_library_names + lua${LUA_VERSION_MAJOR}${LUA_VERSION_MINOR} + lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} + lua-${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} + lua.${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} + ) +endif () + find_library(LUA_LIBRARY NAMES ${_lua_library_names} lua HINTS -- cgit v0.12