Home | History | Annotate | Download | only in cmake
      1 # Locate Lua library
      2 # This module defines
      3 #  LUAJIT_FOUND, if false, do not try to link to Lua
      4 #  LUAJIT_LIBRARIES
      5 #  LUAJIT_INCLUDE_DIR, where to find lua.h
      6 #
      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/
     13 
     14 #=============================================================================
     15 # Copyright 2007-2009 Kitware, Inc.
     16 #
     17 # Distributed under the OSI-approved BSD License (the "License");
     18 # see accompanying file Copyright.txt for details.
     19 #
     20 # This software is distributed WITHOUT ANY WARRANTY; without even the
     21 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     22 # See the License for more information.
     23 #=============================================================================
     24 # (To distributed this file outside of CMake, substitute the full
     25 #  License text for the above reference.)
     26 #
     27 # ################
     28 # 2010 - modified for cronkite to find luajit instead of lua, as it was before.
     29 #
     30 
     31 FIND_PATH(LUAJIT_INCLUDE_DIR lua.h
     32   HINTS
     33   $ENV{LUAJIT_DIR}
     34   PATH_SUFFIXES luajit-2.0 luajit2.0 luajit luajit-2.1
     35   PATHS
     36   ~/Library/Frameworks
     37   /Library/Frameworks
     38   /usr/local
     39   /usr
     40   /sw # Fink
     41   /opt/local # DarwinPorts
     42   /opt/csw # Blastwave
     43   /opt
     44 )
     45 
     46 FIND_LIBRARY(LUAJIT_LIBRARY
     47   NAMES libluajit-51.a libluajit-5.1.a libluajit.a libluajit-5.1.so
     48   HINTS
     49   $ENV{LUAJIT_DIR}
     50   PATH_SUFFIXES lib64 lib
     51   PATHS
     52   ~/Library/Frameworks
     53   /Library/Frameworks
     54   /usr/local
     55   /usr
     56   /sw
     57   /opt/local
     58   /opt/csw
     59   /opt
     60 )
     61 
     62 IF(LUAJIT_LIBRARY)
     63   IF(UNIX AND NOT APPLE)
     64     FIND_LIBRARY(LUAJIT_MATH_LIBRARY m)
     65 	FIND_LIBRARY(LUAJIT_DL_LIBRARY dl)
     66 	SET( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_DL_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
     67   ELSE(UNIX AND NOT APPLE)
     68     SET( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries")
     69   ENDIF(UNIX AND NOT APPLE)
     70 ENDIF(LUAJIT_LIBRARY)
     71 
     72 INCLUDE(FindPackageHandleStandardArgs)
     73 # handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
     74 # all listed variables are TRUE
     75 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT  DEFAULT_MSG  LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR)
     76 
     77 MARK_AS_ADVANCED(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY)
     78