summaryrefslogtreecommitdiffstats
path: root/CheckLua.cmake
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-07-17 16:23:29 +0200
committerMattes D <github@xoft.cz>2016-07-18 22:11:41 +0200
commit430b62322355c0bfe6233586c9823013d60a3335 (patch)
treeed6adc62f2a7e2a5b2d39056eac962ec5a680cb5 /CheckLua.cmake
parentAPIDump: Added explicit IsStatic flag to static functions. (diff)
downloadcuberite-430b62322355c0bfe6233586c9823013d60a3335.tar
cuberite-430b62322355c0bfe6233586c9823013d60a3335.tar.gz
cuberite-430b62322355c0bfe6233586c9823013d60a3335.tar.bz2
cuberite-430b62322355c0bfe6233586c9823013d60a3335.tar.lz
cuberite-430b62322355c0bfe6233586c9823013d60a3335.tar.xz
cuberite-430b62322355c0bfe6233586c9823013d60a3335.tar.zst
cuberite-430b62322355c0bfe6233586c9823013d60a3335.zip
Diffstat (limited to '')
-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)