aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindLUA.cmake
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2009-09-09 13:20:33 +0000
committerJörg Mayer <jmayer@loplof.de>2009-09-09 13:20:33 +0000
commitca6b1e2b2142c7727bca82540c14d2a9c41e1a05 (patch)
tree5f35b5d74741be36415415d8d68acdd479e5c606 /cmake/modules/FindLUA.cmake
parenta65f72e8f045ec9c17848c6508c9ccd27e2e91f4 (diff)
CMAKE: Get most of of missing *build* pieces into place
svn path=/trunk/; revision=29819
Diffstat (limited to 'cmake/modules/FindLUA.cmake')
-rw-r--r--cmake/modules/FindLUA.cmake60
1 files changed, 60 insertions, 0 deletions
diff --git a/cmake/modules/FindLUA.cmake b/cmake/modules/FindLUA.cmake
new file mode 100644
index 0000000000..55e47a864d
--- /dev/null
+++ b/cmake/modules/FindLUA.cmake
@@ -0,0 +1,60 @@
+# Locate Lua library
+# This module defines
+# LUA_FOUND, if false, do not try to link to Lua
+# LUA_LIBRARIES
+# LUA_INCLUDE_DIRS, where to find lua.h
+#
+# Note that the expected include convention is
+# #include "lua.h"
+# and not
+# #include <lua/lua.h>
+# This is because, the lua location is not standardized and may exist
+# in locations other than lua/
+
+
+FIND_PATH(LUA_INCLUDE_DIR lua.h
+ HINTS
+ $ENV{LUA_DIR}
+ PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /usr
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+
+FIND_LIBRARY(LUA_LIBRARY
+ NAMES lua51 lua5.1 lua
+ HINTS
+ $ENV{LUA_DIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /usr
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LUA DEFAULT_MSG LUA_LIBRARY LUA_INCLUDE_DIR)
+
+IF(LUA_LIBRARY)
+ SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
+ SET( LUA_INCLUDE_DIRS ${LUA_INCLUDE_DIR} )
+ELSE(LUA_LIBRARY)
+ SET( LUA_LIBRARIES )
+ SET( LUA_INCLUDE_DIRS )
+ENDIF(LUA_LIBRARY)
+
+MARK_AS_ADVANCED(LUA_INCLUDE_DIRS LUA_LIBRARIES)
+