cmake_modules/FindLua51.cmake
author smxx
Wed, 10 Feb 2010 00:55:40 +0000
changeset 2786 85f6425a4d74
permissions -rw-r--r--
Engine: * Added LUA scripting support for trainings (and maybe soon) scenarios/missions * Converted Shotgun and Bazooka Training to LUA * New dependency: LUA 5.1 * New Mission Objectives window * Extended default keybinds for non-iPhone builds * NOTE: Script function names etc. might change soon so don't work too hard on your own missions (for now)! This is experimental! Frontend: * Added support for new training maps/LUA scripts
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)