3 # LUA50_FOUND, if false, do not try to link to Lua
4 # LUA_LIBRARIES, both lua and lualib
5 # LUA_INCLUDE_DIR, where to find lua.h and lualib.h (and probably lauxlib.h)
7 # Note that the expected include convention is
10 # #include <lua/lua.h>
11 # This is because, the lua location is not standardized and may exist
12 # in locations other than lua/
15 FIND_PATH(LUA_INCLUDE_DIR lua.h
18 PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include
25 /opt/local # DarwinPorts
30 FIND_LIBRARY(LUA_LIBRARY_lua
31 NAMES lua50 lua5.0 lua-5.0 lua5 lua
34 PATH_SUFFIXES lib64 lib
46 # In an OS X framework, lualib is usually included as part of the framework
47 # (like GLU in OpenGL.framework)
48 IF(${LUA_LIBRARY_lua} MATCHES "framework")
49 SET( LUA_LIBRARIES "${LUA_LIBRARY_lua}" CACHE STRING "Lua framework")
50 ELSE(${LUA_LIBRARY_lua} MATCHES "framework")
51 FIND_LIBRARY(LUA_LIBRARY_lualib
52 NAMES lualib50 lualib5.0 lualib5 lualib
56 PATH_SUFFIXES lib64 lib
65 IF(LUA_LIBRARY_lualib AND LUA_LIBRARY_lua)
66 # include the math library for Unix
67 IF(UNIX AND NOT APPLE)
68 FIND_LIBRARY(MATH_LIBRARY_FOR_LUA m)
69 SET( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "This is the concatentation of lua and lualib libraries")
70 # For Windows and Mac, don't need to explicitly include the math library
71 ELSE(UNIX AND NOT APPLE)
72 SET( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua}" CACHE STRING "This is the concatentation of lua and lualib libraries")
73 ENDIF(UNIX AND NOT APPLE)
74 ENDIF(LUA_LIBRARY_lualib AND LUA_LIBRARY_lua)
75 ENDIF(${LUA_LIBRARY_lua} MATCHES "framework")
78 INCLUDE(FindPackageHandleStandardArgs)
79 # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
80 # all listed variables are TRUE
81 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua50 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR)
83 MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES)