summaryrefslogtreecommitdiff
blob: c31c8514ea29245354393949b6bb5cfecf4964b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -215,8 +215,6 @@
 	message (STATUS "LuaJIT headers: ${LUA_INCLUDE_DIR}")
 else (NOT ${DISABLE_LUAJIT} MATCHES "1")
 	message (STATUS "LuaJIT detection disabled! (DISABLE_LUAJIT=1)")
-	set(LUA_LIBRARY "")
-	set(LUA_INCLUDE_DIR "")
 endif (NOT DISABLE_LUAJIT)
 
 set(USE_LUAJIT 0)
@@ -267,11 +265,22 @@
 	endif (VALID_LUAJIT_VERSION)
 endif (LUA_LIBRARY AND LUA_INCLUDE_DIR)
 
+OPTION(WITH_BUNDLED_LUA "Use bundled lua")
+
 if(NOT USE_LUAJIT)
 	message (STATUS "LuaJIT not found, using bundled Lua.")
-	set(LUA_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lua/src")
-	set(LUA_LIBRARY "lua")
-	add_subdirectory(lua)
+	if (WITH_BUNDLED_LUA)
+		set(LUA_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lua/src")
+		set(LUA_LIBRARY "lua")
+		add_subdirectory(lua)
+	else (WITH_BUNDLED_LUA)
+		find_package(Lua51)
+		if(LUA51_FOUND)
+			message (STATUS "Lua51 found")
+		else(LUA51_FOUND)
+			message (FATAL_ERROR "Lua51 not found!")
+		endif(LUA51_FOUND)
+	endif(WITH_BUNDLED_LUA)
 endif(NOT USE_LUAJIT)
 
 mark_as_advanced(LUA_LIBRARY)