cmake_modules/FindLua51.cmake
author smxx
Wed, 10 Feb 2010 00:57:39 +0000
changeset 2787 cf5fc37b4508
parent 2786 85f6425a4d74
permissions -rw-r--r--
* Casing ... *whistle*
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2786
85f6425a4d74 Engine:
smxx
parents:
diff changeset
     1
# Find the Lua 5.1 includes and library
85f6425a4d74 Engine:
smxx
parents:
diff changeset
     2
#
85f6425a4d74 Engine:
smxx
parents:
diff changeset
     3
# LUA51_INCLUDE_DIR - where to find lua.h
85f6425a4d74 Engine:
smxx
parents:
diff changeset
     4
# LUA51_LIBRARIES - List of fully qualified libraries to link against
85f6425a4d74 Engine:
smxx
parents:
diff changeset
     5
# LUA51_FOUND - Set to TRUE if found
85f6425a4d74 Engine:
smxx
parents:
diff changeset
     6
85f6425a4d74 Engine:
smxx
parents:
diff changeset
     7
# Copyright (c) 2007, Pau Garcia i Quiles, <pgquiles@elpauer.org>
85f6425a4d74 Engine:
smxx
parents:
diff changeset
     8
#
85f6425a4d74 Engine:
smxx
parents:
diff changeset
     9
# Redistribution and use is allowed according to the terms of the BSD license.
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    10
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    11
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    12
IF(LUA51_INCLUDE_DIR AND LUA51_LIBRARIES)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    13
    SET(LUA51_FIND_QUIETLY TRUE)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    14
ENDIF(LUA51_INCLUDE_DIR AND LUA51_LIBRARIES)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    15
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    16
FIND_PATH(LUA51_INCLUDE_DIR lua5.1/lua.h)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    17
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    18
FIND_LIBRARY(LUA51_LIBRARIES NAMES lua5.1)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    19
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    20
IF(LUA51_INCLUDE_DIR AND LUA51_LIBRARIES)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    21
   SET(LUA51_FOUND TRUE)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    22
   INCLUDE(CheckLibraryExists)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    23
   CHECK_LIBRARY_EXISTS(${LUA51_LIBRARIES} lua_close "" LUA51_NEED_PREFIX)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    24
ELSE(LUA51_INCLUDE_DIR AND LUA51_LIBRARIES)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    25
   SET(LUA51_FOUND FALSE)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    26
   MESSAGE("D'oh")
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    27
ENDIF (LUA51_INCLUDE_DIR AND LUA51_LIBRARIES)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    28
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    29
IF(LUA51_FOUND)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    30
  IF (NOT LUA51_FIND_QUIETLY)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    31
    MESSAGE(STATUS "Found Lua 5.1 library: ${LUA51_LIBRARIES}")
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    32
    MESSAGE(STATUS "Found Lua 5.1 headers: ${LUA51_INCLUDE_DIR}")
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    33
  ENDIF (NOT LUA51_FIND_QUIETLY)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    34
ELSE(LUA51_FOUND)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    35
  IF(LUA51_FIND_REQUIRED)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    36
    MESSAGE(FATAL_ERROR "Could NOT find Lua 5.1")
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    37
  ENDIF(LUA51_FIND_REQUIRED)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    38
ENDIF(LUA51_FOUND)
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    39
85f6425a4d74 Engine:
smxx
parents:
diff changeset
    40
MARK_AS_ADVANCED(LUA51_INCLUDE_DIR LUA51_LIBRARIES)