[1133] | 1 | # Find Lua header and library files |
---|
[946] | 2 | # |
---|
[1133] | 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 |
---|
[946] | 8 | # |
---|
[1133] | 9 | # authors: Benjamin Knecht, Reto Grieder |
---|
[1037] | 10 | |
---|
[946] | 11 | IF (Lua_LIBRARIES AND Lua_INCLUDE_DIR) |
---|
[1037] | 12 | |
---|
[1133] | 13 | # Already in cache, be silent |
---|
| 14 | SET(Lua_FOUND TRUE) |
---|
| 15 | SET(Lua_FIND_QUIETLY TRUE) |
---|
| 16 | MESSAGE(STATUS "Lua was found.") |
---|
[1037] | 17 | |
---|
[1133] | 18 | ELSE (Lua_LIBRARIES AND Lua_INCLUDE_DIR) |
---|
[1037] | 19 | |
---|
[1133] | 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) |
---|
[1037] | 24 | |
---|
[1133] | 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) |
---|
[1037] | 29 | |
---|
[1133] | 30 | FIND_LIBRARY(Lua_LIBRARY_51 lua5.1 |
---|
| 31 | /usr/lib |
---|
| 32 | /usr/local/lib |
---|
| 33 | ../libs/lua-5.1.3/lib) |
---|
[1037] | 34 | |
---|
[1133] | 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) |
---|
[1037] | 39 | |
---|
[1133] | 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) |
---|
[1037] | 44 | |
---|
| 45 | |
---|
[1133] | 46 | IF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51) |
---|
[1037] | 47 | |
---|
[1133] | 48 | # Found newer lua 5.1 libs |
---|
[946] | 49 | SET(Lua_FOUND TRUE) |
---|
[1133] | 50 | SET(Lua_VERSION 5.1 CACHE STRING "") |
---|
| 51 | SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_51} CACHE PATH "") |
---|
| 52 | SET(Lua_LIBRARIES ${Lua_LIBRARY_51} CACHE FILEPATH "") |
---|
[946] | 53 | |
---|
[1133] | 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) |
---|
| 58 | SET(Lua_VERSION 5.0 CACHE STRING "") |
---|
| 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) |
---|
[946] | 66 | MESSAGE(STATUS "Found Lua: ${Lua_LIBRARIES}") |
---|
[1133] | 67 | ELSE (Lua_FOUND) |
---|
[946] | 68 | IF (Lua_FIND_REQUIRED) |
---|
[1133] | 69 | MESSAGE(FATAL_ERROR "Could not find Lua") |
---|
[946] | 70 | ENDIF (Lua_FIND_REQUIRED) |
---|
[1133] | 71 | ENDIF (Lua_FOUND) |
---|
| 72 | |
---|
| 73 | ENDIF (Lua_LIBRARIES AND Lua_INCLUDE_DIR) |
---|
| 74 | |
---|