ENH: fix bug where sharedforward would not work if there was a space in the path...
[cmake.git] / Modules / FindLua51.cmake
blob5f50ec2ca2f01c61bdfeb1078fad14f93a4f8a40
1 # Locate Lua library
2 # This module defines
3 #  LUA51_FOUND, if false, do not try to link to Lua 
4 #  LUA_LIBRARIES
5 #  LUA_INCLUDE_DIR, where to find lua.h 
7 # Note that the expected include convention is
8 #  #include "lua.h"
9 # and not
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
16   HINTS
17   $ENV{LUA_DIR}
18   PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
19   PATHS
20   ~/Library/Frameworks
21   /Library/Frameworks
22   /usr/local
23   /usr
24   /sw # Fink
25   /opt/local # DarwinPorts
26   /opt/csw # Blastwave
27   /opt
30 FIND_LIBRARY(LUA_LIBRARY 
31   NAMES lua51 lua5.1 lua
32   HINTS
33   $ENV{LUA_DIR}
34   PATH_SUFFIXES lib64 lib
35   PATHS
36   ~/Library/Frameworks
37   /Library/Frameworks
38   /usr/local
39   /usr
40   /sw
41   /opt/local
42   /opt/csw
43   /opt
46 IF(LUA_LIBRARY)
47   # include the math library for Unix
48   IF(UNIX AND NOT APPLE)
49     FIND_LIBRARY(LUA_MATH_LIBRARY m)
50     SET( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
51   # For Windows and Mac, don't need to explicitly include the math library
52   ELSE(UNIX AND NOT APPLE)
53     SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
54   ENDIF(UNIX AND NOT APPLE)
55 ENDIF(LUA_LIBRARY)
57 INCLUDE(FindPackageHandleStandardArgs)
58 # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if 
59 # all listed variables are TRUE
60 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51  DEFAULT_MSG  LUA_LIBRARIES LUA_INCLUDE_DIR)
62 MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)