diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2014-07-11 12:12:18 +0100 |
---|---|---|
committer | John Szakmeister <john@szakmeister.net> | 2014-07-11 19:28:54 -0400 |
commit | 5d44f89a8cdd41531177f041fb73f106c03686d8 (patch) | |
tree | 63401fd0e0b5ca766695366a32e05ab956ae1475 | |
parent | 6f0d3c0e77bbcd769effed3e5568d9038486f16d (diff) | |
download | rneovim-5d44f89a8cdd41531177f041fb73f106c03686d8.tar.gz rneovim-5d44f89a8cdd41531177f041fb73f106c03686d8.tar.bz2 rneovim-5d44f89a8cdd41531177f041fb73f106c03686d8.zip |
Check dependencies for each lua interpreter.
- When USE_BUNDLED=OFF and the system has multiple lua interpreters
(luajit AND lua) it may occur that only the later has the needed
dependencies (lua-lpeg, lua-cmsgpack). If we pick luajit then
finding the dependencies FAILS.
- This commit groups detection of the lua interpreter with the lua
dependencies it tries to find them for both the interpreters and
choses the first one that has them.
Helped-by: John Szakmeister <john@szakmeister.net>
-rw-r--r-- | CMakeLists.txt | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 97b21d1f14..b95f7fd277 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,16 +91,26 @@ find_package(Threads REQUIRED) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -find_program(LUA_PRG luajit) - -# Need a lua interpreter for running the msgapck metadata/dispatch generator -if(NOT EXISTS ${LUA_PRG}) - find_program(LUA_PRG lua) -endif() - +# Find Lua interpreter include(LuaHelpers) set(LUA_DEPENDENCIES lpeg cmsgpack) -check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS) +if(NOT LUA_PRG) + foreach(CURRENT_LUA_PRG luajit lua) + # If LUA_PRG is set find_program() will not search + unset(LUA_PRG CACHE) + unset(LUA_PRG_WORKS) + find_program(LUA_PRG ${CURRENT_LUA_PRG}) + + if(LUA_PRG) + check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS) + if(LUA_PRG_WORKS) + break() + endif() + endif() + endforeach() +else() + check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS) +endif() if(NOT LUA_PRG_WORKS) message(FATAL_ERROR "A suitable Lua interpreter was not found") |