summaryrefslogtreecommitdiffstats
path: root/CheckLua.cmake
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-07-19 10:15:49 +0200
committerGitHub <noreply@github.com>2016-07-19 10:15:49 +0200
commitc54691a3e578c0c33f0e196959a4c224883b1c93 (patch)
treebb258a4eb246e062e3ad9b3cfa2119411bb1d4ac /CheckLua.cmake
parentFixes for boat entities (#3265) (diff)
parentCMake: Silenced CMP0054 policy warning. (diff)
downloadcuberite-c54691a3e578c0c33f0e196959a4c224883b1c93.tar
cuberite-c54691a3e578c0c33f0e196959a4c224883b1c93.tar.gz
cuberite-c54691a3e578c0c33f0e196959a4c224883b1c93.tar.bz2
cuberite-c54691a3e578c0c33f0e196959a4c224883b1c93.tar.lz
cuberite-c54691a3e578c0c33f0e196959a4c224883b1c93.tar.xz
cuberite-c54691a3e578c0c33f0e196959a4c224883b1c93.tar.zst
cuberite-c54691a3e578c0c33f0e196959a4c224883b1c93.zip
Diffstat (limited to 'CheckLua.cmake')
-rw-r--r--CheckLua.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/CheckLua.cmake b/CheckLua.cmake
new file mode 100644
index 000000000..e8827fe00
--- /dev/null
+++ b/CheckLua.cmake
@@ -0,0 +1,23 @@
+# CheckLua.cmake
+
+# Checks whether the Lua standalone interpreter is installed on the host system
+# If found, sets HAS_LUA_INTERPRETER to 1 and LUA_INTERPRETER_VERSION to the version reported ("5.1" etc.)
+# If not found, unsets HAS_LUA_INTERPRETER
+
+
+
+
+execute_process(
+ COMMAND lua -e "io.stdout:write(string.match(_VERSION, '%d+%.%d+'))"
+ RESULT_VARIABLE LUA_EXECUTED
+ OUTPUT_VARIABLE LUA_INTERPRETER_VERSION
+)
+
+if ("${LUA_EXECUTED}" STREQUAL "0")
+ set(HAS_LUA_INTERPRETER 1)
+else()
+ unset(HAS_LUA_INTERPRETER)
+ unset(LUA_INTERPRETER_VERSION)
+endif()
+
+unset(LUA_EXECUTED)