[1505] | 1 | # Find Lua header and library files |
---|
| 2 | # |
---|
| 3 | # When called, this script tries to define: |
---|
| 4 | # Lua_INCLUDE_DIR Header files directory |
---|
| 5 | # Lua_LIBRARIES library files (or file when using lua 5.1) |
---|
| 6 | # Lua_FOUND defined (true) if lua was found |
---|
| 7 | # Lua_VERSION either 5.1 or 5.0 or undefined |
---|
| 8 | # |
---|
| 9 | # authors: Benjamin Knecht, Reto Grieder |
---|
| 10 | |
---|
| 11 | IF (Lua_LIBRARIES AND Lua_INCLUDE_DIR) |
---|
| 12 | |
---|
| 13 | # Already in cache, be silent |
---|
| 14 | SET(Lua_FOUND TRUE) |
---|
| 15 | SET(Lua_FIND_QUIETLY TRUE) |
---|
| 16 | MESSAGE(STATUS "Lua was found.") |
---|
| 17 | |
---|
| 18 | ELSE (Lua_LIBRARIES AND Lua_INCLUDE_DIR) |
---|
| 19 | |
---|
| 20 | FIND_PATH(Lua_INCLUDE_DIR_51 lua.h |
---|
| 21 | /usr/include/lua5.1 |
---|
| 22 | /usr/local/include/lua5.1 |
---|
| 23 | ../libs/lua-5.1.3/src) |
---|
| 24 | |
---|
| 25 | FIND_PATH(Lua_INCLUDE_DIR_50 lua.h |
---|
| 26 | /usr/include/lua50 |
---|
| 27 | /usr/local/include/lua50 |
---|
| 28 | /usr/pack/lua-5.0.3-sd/include) |
---|
| 29 | |
---|
| 30 | FIND_LIBRARY(Lua_LIBRARY_51 NAMES lua5.1 lua PATHS |
---|
| 31 | /usr/lib |
---|
| 32 | /usr/local/lib |
---|
| 33 | ../libs/lua-5.1.3/lib) |
---|
| 34 | |
---|
| 35 | FIND_LIBRARY(Lua_LIBRARY_1_50 NAMES lua50 lua PATHS |
---|
| 36 | /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis |
---|
| 37 | /usr/lib |
---|
| 38 | /usr/local/lib) |
---|
| 39 | |
---|
| 40 | FIND_LIBRARY(Lua_LIBRARY_2_50 NAMES lualib50 lualib PATHS |
---|
| 41 | /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis |
---|
| 42 | /usr/lib |
---|
| 43 | /usr/local/lib) |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | IF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51) |
---|
| 47 | |
---|
| 48 | # Found newer lua 5.1 libs |
---|
| 49 | SET(Lua_FOUND TRUE) |
---|
[1651] | 50 | SET(Lua_VERSION "5.1" CACHE STRING "") |
---|
[1505] | 51 | SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_51} CACHE PATH "") |
---|
| 52 | SET(Lua_LIBRARIES ${Lua_LIBRARY_51} CACHE FILEPATH "") |
---|
| 53 | |
---|
| 54 | ELSEIF(Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50) |
---|
| 55 | |
---|
| 56 | # Found older lua 5.0 libs |
---|
| 57 | SET(Lua_FOUND TRUE) |
---|
[1651] | 58 | SET(Lua_VERSION "5.0" CACHE STRING "") |
---|
[1505] | 59 | SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_50} CACHE PATH "") |
---|
| 60 | SET(Lua_LIBRARIES ${Lua_LIBRARY_1_50} ${Lua_LIBRARY_2_50} CACHE FILEPATH "") |
---|
| 61 | |
---|
| 62 | ENDIF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51) |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | IF (Lua_FOUND) |
---|
| 66 | MESSAGE(STATUS "Found Lua: ${Lua_LIBRARIES}") |
---|
| 67 | ELSE (Lua_FOUND) |
---|
| 68 | IF (Lua_FIND_REQUIRED) |
---|
| 69 | MESSAGE(FATAL_ERROR "Could not find Lua") |
---|
| 70 | ENDIF (Lua_FIND_REQUIRED) |
---|
| 71 | ENDIF (Lua_FOUND) |
---|
| 72 | |
---|
| 73 | ENDIF (Lua_LIBRARIES AND Lua_INCLUDE_DIR) |
---|
| 74 | |
---|