summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorIvan Ivanov <anonim288@gmail.com>2016-06-20 16:45:59 (GMT)
committerBrad King <brad.king@kitware.com>2016-06-20 18:40:40 (GMT)
commit3532cbce18f4021507a0fd8d23d0930aa09ae8e1 (patch)
treef424b9319e1d397d10b5f1aebd3bf618da7347e2 /Modules
parent281c707b65dee100f09b4782a3d7e60bc8d29db8 (diff)
downloadCMake-3532cbce18f4021507a0fd8d23d0930aa09ae8e1.zip
CMake-3532cbce18f4021507a0fd8d23d0930aa09ae8e1.tar.gz
CMake-3532cbce18f4021507a0fd8d23d0930aa09ae8e1.tar.bz2
FindLua: Check header file against suitable versions
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindLua.cmake17
1 files changed, 12 insertions, 5 deletions
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index 6a9d5b5..4af3bbf 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -49,6 +49,7 @@
unset(_lua_include_subdirs)
unset(_lua_library_names)
+unset(_lua_append_versions)
# this is a function only to have all the variables inside go away automatically
function(_lua_set_version_vars)
@@ -93,6 +94,7 @@ function(_lua_set_version_vars)
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)
function(_lua_check_header_version _hdr_file)
@@ -116,11 +118,15 @@ function(_lua_check_header_version _hdr_file)
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
endif ()
-
- set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE)
- set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE)
- set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE)
- set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE)
+ foreach (ver IN LISTS _lua_append_versions)
+ if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}")
+ set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE)
+ set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE)
+ set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE)
+ set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE)
+ return()
+ endif ()
+ endforeach ()
endfunction(_lua_check_header_version)
_lua_set_version_vars()
@@ -138,6 +144,7 @@ find_path(LUA_INCLUDE_DIR lua.h
/opt
)
unset(_lua_include_subdirs)
+unset(_lua_append_versions)
find_library(LUA_LIBRARY
NAMES ${_lua_library_names} lua