[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 |
---|
[1776] | 10 | # |
---|
| 11 | # Several changes and additions by Fabian 'x3n' Landau |
---|
| 12 | # > www.orxonox.net < |
---|
[1505] | 13 | |
---|
| 14 | IF (Lua_LIBRARIES AND Lua_INCLUDE_DIR) |
---|
| 15 | |
---|
| 16 | # Already in cache, be silent |
---|
| 17 | SET(Lua_FOUND TRUE) |
---|
| 18 | SET(Lua_FIND_QUIETLY TRUE) |
---|
[1776] | 19 | # MESSAGE(STATUS "Lua was found.") |
---|
[1505] | 20 | |
---|
| 21 | ELSE (Lua_LIBRARIES AND Lua_INCLUDE_DIR) |
---|
| 22 | |
---|
| 23 | FIND_PATH(Lua_INCLUDE_DIR_51 lua.h |
---|
| 24 | /usr/include/lua5.1 |
---|
| 25 | /usr/local/include/lua5.1 |
---|
[1776] | 26 | ../libs/lua-5.1.3/include) |
---|
[1505] | 27 | |
---|
| 28 | FIND_PATH(Lua_INCLUDE_DIR_50 lua.h |
---|
| 29 | /usr/include/lua50 |
---|
| 30 | /usr/local/include/lua50 |
---|
| 31 | /usr/pack/lua-5.0.3-sd/include) |
---|
| 32 | |
---|
| 33 | FIND_LIBRARY(Lua_LIBRARY_51 NAMES lua5.1 lua PATHS |
---|
| 34 | /usr/lib |
---|
| 35 | /usr/local/lib |
---|
| 36 | ../libs/lua-5.1.3/lib) |
---|
| 37 | |
---|
| 38 | FIND_LIBRARY(Lua_LIBRARY_1_50 NAMES lua50 lua PATHS |
---|
[1776] | 39 | /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis |
---|
[1505] | 40 | /usr/lib |
---|
| 41 | /usr/local/lib) |
---|
| 42 | |
---|
| 43 | FIND_LIBRARY(Lua_LIBRARY_2_50 NAMES lualib50 lualib PATHS |
---|
[1776] | 44 | /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis |
---|
[1505] | 45 | /usr/lib |
---|
| 46 | /usr/local/lib) |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | IF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51) |
---|
| 50 | |
---|
| 51 | # Found newer lua 5.1 libs |
---|
| 52 | SET(Lua_FOUND TRUE) |
---|
[1755] | 53 | SET(Lua_VERSION "5.1" CACHE STRING "") |
---|
[1505] | 54 | SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_51} CACHE PATH "") |
---|
| 55 | SET(Lua_LIBRARIES ${Lua_LIBRARY_51} CACHE FILEPATH "") |
---|
[1776] | 56 | SET(Lua_LIBRARY_NAMES "lua5.1 lua") |
---|
[1505] | 57 | |
---|
| 58 | ELSEIF(Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50) |
---|
| 59 | |
---|
| 60 | # Found older lua 5.0 libs |
---|
| 61 | SET(Lua_FOUND TRUE) |
---|
[1755] | 62 | SET(Lua_VERSION "5.0" CACHE STRING "") |
---|
[1505] | 63 | SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_50} CACHE PATH "") |
---|
| 64 | SET(Lua_LIBRARIES ${Lua_LIBRARY_1_50} ${Lua_LIBRARY_2_50} CACHE FILEPATH "") |
---|
[1776] | 65 | SET(Lua_LIBRARY_NAMES "lua50 lua, lualib50 lualib") |
---|
[1505] | 66 | |
---|
| 67 | ENDIF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51) |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | IF (Lua_FOUND) |
---|
[1776] | 71 | MESSAGE(STATUS "Lua was found.") |
---|
| 72 | IF (VERBOSE_FIND) |
---|
| 73 | MESSAGE (STATUS " include path: ${Lua_INCLUDE_DIR}") |
---|
| 74 | MESSAGE (STATUS " library path: ${Lua_LIBRARIES}") |
---|
| 75 | MESSAGE (STATUS " libraries: ${Lua_LIBRARY_NAMES}") |
---|
| 76 | ENDIF (VERBOSE_FIND) |
---|
[1505] | 77 | ELSE (Lua_FOUND) |
---|
[1776] | 78 | IF (Lua_INCLUDE_DIR_51 AND NOT Lua_LIBRARY_51) |
---|
| 79 | MESSAGE(SEND_ERROR "Lua 5.1 library was not found") |
---|
| 80 | ENDIF (Lua_INCLUDE_DIR_51 AND NOT Lua_LIBRARY_51) |
---|
| 81 | IF (NOT Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51) |
---|
| 82 | MESSAGE(SEND_ERROR "Lua 5.1 include path was not found") |
---|
| 83 | ENDIF (NOT Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51) |
---|
| 84 | |
---|
| 85 | IF (Lua_INCLUDE_DIR_50) |
---|
| 86 | IF (NOT Lua_LIBRARY_1_50) |
---|
| 87 | MESSAGE(SEND_ERROR "Lua 5.0 library "lua" was not found") |
---|
| 88 | ENDIF (NOT Lua_LIBRARY_1_50) |
---|
| 89 | IF (NOT Lua_LIBRARY_2_50) |
---|
| 90 | MESSAGE(SEND_ERROR "Lua 5.0 library "lualib" was not found") |
---|
| 91 | ENDIF (NOT Lua_LIBRARY_2_50) |
---|
| 92 | ENDIF (Lua_INCLUDE_DIR_50) |
---|
| 93 | IF (NOT Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50) |
---|
| 94 | MESSAGE(SEND_ERROR "Lua 5.0 include path was not found") |
---|
| 95 | ENDIF (NOT Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50) |
---|
| 96 | |
---|
| 97 | MESSAGE(SEND_ERROR "Lua was not found.") |
---|
[1505] | 98 | ENDIF (Lua_FOUND) |
---|
| 99 | |
---|
| 100 | ENDIF (Lua_LIBRARIES AND Lua_INCLUDE_DIR) |
---|
| 101 | |
---|