cmake_modules/FindLua.cmake
author smxx
Sat, 27 Mar 2010 21:04:38 +0000
changeset 3127 9ebdc21aba87
parent 3125 f110cc84ac50
child 3128 8702d3479d10
permissions -rw-r--r--
CMake * I must not eat melon bombs * I must not eat melon bombs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2924
908851e59958 Engine:
smxx
parents:
diff changeset
     1
# Find the Lua library
908851e59958 Engine:
smxx
parents:
diff changeset
     2
#
908851e59958 Engine:
smxx
parents:
diff changeset
     3
2925
d088b5f813c9 CMAKE SMASH!
smxx
parents: 2924
diff changeset
     4
IF(NOT LUA_LIBRARY)
d088b5f813c9 CMAKE SMASH!
smxx
parents: 2924
diff changeset
     5
	IF(WIN32)
3067
smxx
parents: 2925
diff changeset
     6
		SET(LUA_DEFAULT lua.dll)
2925
d088b5f813c9 CMAKE SMASH!
smxx
parents: 2924
diff changeset
     7
	ELSE(WIN32)
d088b5f813c9 CMAKE SMASH!
smxx
parents: 2924
diff changeset
     8
		IF(APPLE)
3067
smxx
parents: 2925
diff changeset
     9
			SET(LUA_DEFAULT lua)
2925
d088b5f813c9 CMAKE SMASH!
smxx
parents: 2924
diff changeset
    10
		ELSE(APPLE)
3067
smxx
parents: 2925
diff changeset
    11
			#locate the system's lua library
smxx
parents: 2925
diff changeset
    12
			FIND_LIBRARY(LUA_DEFAULT NAMES lua51 lua5.1 lua-5.1 lua PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib)
3127
smxx
parents: 3125
diff changeset
    13
			IF(${LUA_DEFAULT} EQUALS "LUA_DEFAULT-NOTFOUND")
3125
smxx
parents: 3067
diff changeset
    14
				UNSET(LUA_DEFAULT)
smxx
parents: 3067
diff changeset
    15
				MESSAGE(FATAL_ERROR "Couldn't find Lua 5.1 library!")
smxx
parents: 3067
diff changeset
    16
			ENDIF()
3067
smxx
parents: 2925
diff changeset
    17
			#remove the path (fpc doesn't like it - why?)
smxx
parents: 2925
diff changeset
    18
			GET_FILENAME_COMPONENT(LUA_DEFAULT ${LUA_DEFAULT} NAME)
2925
d088b5f813c9 CMAKE SMASH!
smxx
parents: 2924
diff changeset
    19
		ENDIF(APPLE)
d088b5f813c9 CMAKE SMASH!
smxx
parents: 2924
diff changeset
    20
	ENDIF(WIN32)
d088b5f813c9 CMAKE SMASH!
smxx
parents: 2924
diff changeset
    21
	SET(LUA_LIBRARY ${LUA_DEFAULT} CACHE STRING "Lua library to link to; file name without path only!")
3067
smxx
parents: 2925
diff changeset
    22
	UNSET(LUA_DEFAULT)
2925
d088b5f813c9 CMAKE SMASH!
smxx
parents: 2924
diff changeset
    23
ENDIF(NOT LUA_LIBRARY)