[CMake] FindLua50.cmake, FindLua51.cmake

Pau Garcia i Quiles pgquiles at elpauer.org
Mon May 21 05:07:33 EDT 2007


Hello,

Here come two packages to find Lua 5.0 and Lua 5.1. They work fine for  
me on on KUbuntu 7.04, YMMV.

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to the amount of work, I usually need 10 days to answer)




-------------- next part --------------
# Find the Lua 5.0 includes and library
#
# Lua50_INCLUDE_DIR - where to find lua.h
# Lua50_LIBRARIES - List of fully qualified libraries to link against
# Lua50_FOUND - Set to TRUE if found

# Copyright (c) 2007, Pau Garcia i Quiles, <pgquiles at elpauer.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

IF(Lua50_INCLUDE_DIR AND Lua50_LIBRARIES)
    SET(Lua50_FIND_QUIETLY TRUE)
ENDIF(Lua50_INCLUDE_DIR AND Lua50_LIBRARIES)

FIND_PATH(Lua50_INCLUDE_DIR lua50/lua.h )

FIND_LIBRARY(Lua50_LIBRARIES NAMES lua50 )

IF(Lua50_INCLUDE_DIR AND Lua50_LIBRARIES)
   SET(Lua50_FOUND TRUE)
   INCLUDE(CheckLibraryExists)
   CHECK_LIBRARY_EXISTS(${Lua50_LIBRARIES} lua_close "" Lua50_NEED_PREFIX)
ELSE(Lua50_INCLUDE_DIR AND Lua50_LIBRARIES)
   SET(Lua50_FOUND FALSE)
ENDIF (Lua50_INCLUDE_DIR AND Lua50_LIBRARIES)

IF(Lua50_FOUND)
  IF (NOT Lua50_FIND_QUIETLY)
    MESSAGE(STATUS "Found Lua 5.0 library: ${Lua50_LIBRARIES}")
    MESSAGE(STATUS "Found Lua 5.0 headers: ${Lua50_INCLUDE_DIR}")
  ENDIF (NOT Lua50_FIND_QUIETLY)
ELSE(Lua50_FOUND)
  IF(Lua50_FIND_REQUIRED)
    MESSAGE(FATAL_ERROR "Could NOT find Lua 5.0")
  ENDIF(Lua50_FIND_REQUIRED)
ENDIF(Lua50_FOUND)

MARK_AS_ADVANCED(Lua50_INCLUDE_DIR Lua50_LIBRARIES)
-------------- next part --------------
# Find the Lua 5.1 includes and library
#
# Lua51_INCLUDE_DIR - where to find lua.h
# Lua51_LIBRARIES - List of fully qualified libraries to link against
# Lua51_FOUND - Set to TRUE if found

# Copyright (c) 2007, Pau Garcia i Quiles, <pgquiles at elpauer.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

IF(Lua51_INCLUDE_DIR AND Lua51_LIBRARIES)
    SET(Lua51_FIND_QUIETLY TRUE)
ENDIF(Lua51_INCLUDE_DIR AND Lua51_LIBRARIES)

FIND_PATH(Lua51_INCLUDE_DIR lua5.1/lua.h )

FIND_LIBRARY(Lua51_LIBRARIES NAMES lua5.1 )

IF(Lua51_INCLUDE_DIR AND Lua51_LIBRARIES)
   SET(Lua51_FOUND TRUE)
   INCLUDE(CheckLibraryExists)
   CHECK_LIBRARY_EXISTS(${Lua51_LIBRARIES} lua_close "" Lua51_NEED_PREFIX)
ELSE(Lua51_INCLUDE_DIR AND Lua51_LIBRARIES)
   SET(Lua51_FOUND FALSE)
   MESSAGE("D'oh")
ENDIF (Lua51_INCLUDE_DIR AND Lua51_LIBRARIES)

IF(Lua51_FOUND)
  IF (NOT Lua51_FIND_QUIETLY)
    MESSAGE(STATUS "Found Lua 5.1 library: ${Lua51_LIBRARIES}")
    MESSAGE(STATUS "Found Lua 5.1 headers: ${Lua51_INCLUDE_DIR}")
  ENDIF (NOT Lua51_FIND_QUIETLY)
ELSE(Lua51_FOUND)
  IF(Lua51_FIND_REQUIRED)
    MESSAGE(FATAL_ERROR "Could NOT find Lua 5.1")
  ENDIF(Lua51_FIND_REQUIRED)
ENDIF(Lua51_FOUND)

MARK_AS_ADVANCED(Lua51_INCLUDE_DIR Lua51_LIBRARIES)


More information about the CMake mailing list