]> git.sesse.net Git - vlc/blob - extras/buildsystem/cmake/include/FindLua.cmake
Contrib: update zlib to 1.2.5
[vlc] / extras / buildsystem / cmake / include / FindLua.cmake
1 # - Find library containing Lua()
2 # The following variables are set if Lua is found. If Lua is not
3 # found, Lua_FOUND is set to false.
4 #  Lua_FOUND     - System has Lua.
5 #  Lua_LIBRARIES - Link these to use Lua.
6 #  Lua_CFLAGS - Link these to use Lua.
7
8
9 if (NOT Lua_SEARCHED)
10     include(CheckLibraryExists)
11
12     set(Lua_SEARCHED TRUE CACHE INTERNAL "")
13     set(Lua_FOUND FALSE CACHE INTERNAL "")
14
15     pkg_check_modules(Lua lua>=5.1)
16     if (NOT Lua_FOUND)
17         pkg_check_modules(Lua lua5.1)
18     endif (NOT Lua_FOUND)
19
20     if (NOT Lua_FOUND)
21         find_library( Lua_LIBRARY NAMES lua5.1 lua51 lua)
22         if (Lua_LIBRARY)
23               set(Lua_LIBRARIES "${Lua_LIBRARY}" CACHE INTERNAL "")
24               set(Lua_FOUND TRUE CACHE INTERNAL "")
25         endif (Lua_LIBRARY)
26     endif (NOT Lua_FOUND)
27
28     if (Lua_FOUND)
29       if (NOT Lua_FIND_QUIETLY)
30         message(STATUS "Found Lua in: ${Lua_LIBRARIES}")
31       endif (NOT Lua_FIND_QUIETLY)
32     else (Lua_FOUND)
33       if (Lua_FIND_REQUIRED)
34         message(FATAL_ERROR "Could not find the library containing Lua")
35       endif (Lua_FIND_REQUIRED)
36     endif (Lua_FOUND)
37
38     mark_as_advanced(Lua_LIBRARIES)
39 endif(NOT Lua_SEARCHED)