2013-10-15 19:17:36 +04:00
#.rst:
# FindLua50
# ---------
#
#
#
# Locate Lua library This module defines
#
# ::
#
# LUA50_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES, both lua and lualib
# LUA_INCLUDE_DIR, where to find lua.h and lualib.h (and probably lauxlib.h)
#
#
2007-12-21 04:59:44 +03:00
#
# Note that the expected include convention is
2013-10-15 19:17:36 +04:00
#
# ::
#
# #include "lua.h"
#
2007-12-21 04:59:44 +03:00
# and not
2013-10-15 19:17:36 +04:00
#
# ::
#
# #include <lua/lua.h>
#
# This is because, the lua location is not standardized and may exist in
# locations other than lua/
2007-12-21 04:59:44 +03:00
2009-09-28 19:45:50 +04:00
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
2010-08-07 04:48:47 +04:00
# (To distribute this file outside of CMake, substitute the full
2009-09-28 19:45:50 +04:00
# License text for the above reference.)
2007-12-21 04:59:44 +03:00
2012-08-13 21:47:32 +04:00
find_path ( LUA_INCLUDE_DIR lua.h
2008-06-10 00:04:06 +04:00
H I N T S
2012-03-29 02:00:54 +04:00
E N V L U A _ D I R
2007-12-21 04:59:44 +03:00
P A T H _ S U F F I X E S i n c l u d e / l u a 5 0 i n c l u d e / l u a 5 . 0 i n c l u d e / l u a 5 i n c l u d e / l u a i n c l u d e
P A T H S
~ / L i b r a r y / F r a m e w o r k s
/ L i b r a r y / F r a m e w o r k s
/ s w # Fink
/ o p t / l o c a l # DarwinPorts
/ o p t / c s w # Blastwave
/ o p t
)
2012-08-13 21:47:32 +04:00
find_library ( LUA_LIBRARY_lua
2009-01-30 11:02:49 +03:00
N A M E S l u a 5 0 l u a 5 . 0 l u a - 5 . 0 l u a 5 l u a
2008-06-10 00:04:06 +04:00
H I N T S
2012-03-29 02:00:54 +04:00
E N V L U A _ D I R
2012-03-29 02:51:06 +04:00
P A T H _ S U F F I X E S l i b
2007-12-21 04:59:44 +03:00
P A T H S
~ / L i b r a r y / F r a m e w o r k s
/ L i b r a r y / F r a m e w o r k s
/ s w
/ o p t / l o c a l
/ o p t / c s w
/ o p t
)
# In an OS X framework, lualib is usually included as part of the framework
# (like GLU in OpenGL.framework)
2012-08-13 21:47:32 +04:00
if ( ${ LUA_LIBRARY_lua } MATCHES "framework" )
set ( LUA_LIBRARIES "${LUA_LIBRARY_lua}" CACHE STRING "Lua framework" )
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
find_library ( LUA_LIBRARY_lualib
2007-12-21 04:59:44 +03:00
N A M E S l u a l i b 5 0 l u a l i b 5 . 0 l u a l i b 5 l u a l i b
2008-06-10 00:04:06 +04:00
H I N T S
2012-03-29 02:00:54 +04:00
E N V L U A L I B _ D I R
E N V L U A _ D I R
2012-03-29 02:51:06 +04:00
P A T H _ S U F F I X E S l i b
2007-12-21 04:59:44 +03:00
P A T H S
/ s w
/ o p t / l o c a l
/ o p t / c s w
/ o p t
)
2012-08-13 21:47:32 +04:00
if ( LUA_LIBRARY_lualib AND LUA_LIBRARY_lua )
2007-12-21 04:59:44 +03:00
# include the math library for Unix
2012-08-13 21:47:32 +04:00
if ( UNIX AND NOT APPLE )
find_library ( MATH_LIBRARY_FOR_LUA m )
set ( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "This is the concatentation of lua and lualib libraries" )
2007-12-21 04:59:44 +03:00
# For Windows and Mac, don't need to explicitly include the math library
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
set ( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua}" CACHE STRING "This is the concatentation of lua and lualib libraries" )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
endif ( )
2007-12-21 04:59:44 +03:00
2012-08-13 21:47:32 +04:00
include ( ${ CMAKE_CURRENT_LIST_DIR } /FindPackageHandleStandardArgs.cmake )
2012-08-13 21:42:58 +04:00
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
2008-03-10 20:26:11 +03:00
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS ( Lua50 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR )
2007-12-21 04:59:44 +03:00
2012-08-13 21:47:32 +04:00
mark_as_advanced ( LUA_INCLUDE_DIR LUA_LIBRARIES )
2007-12-21 04:59:44 +03:00