From 430b62322355c0bfe6233586c9823013d60a3335 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 17 Jul 2016 16:23:29 +0200 Subject: Use system Lua, if available, to generate bindings. Closes #1031. --- CheckLua.cmake | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 CheckLua.cmake (limited to 'CheckLua.cmake') 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) -- cgit v1.2.3