2014-07-11 04:12:10 -07:00
|
|
|
#
|
|
|
|
# Functions to help checking for a Lua interpreter
|
|
|
|
#
|
|
|
|
|
|
|
|
# Check if a module is available in Lua
|
|
|
|
function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR)
|
2018-02-21 17:22:26 -07:00
|
|
|
execute_process(COMMAND ${LUA_PRG_PATH} -l "${MODULE}" -e ""
|
2018-02-21 17:22:19 -07:00
|
|
|
RESULT_VARIABLE module_missing)
|
2014-07-11 04:12:10 -07:00
|
|
|
if(module_missing)
|
|
|
|
set(${RESULT_VAR} False PARENT_SCOPE)
|
|
|
|
else()
|
|
|
|
set(${RESULT_VAR} True PARENT_SCOPE)
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# Check Lua interpreter for dependencies
|
|
|
|
function(check_lua_deps LUA_PRG_PATH MODULES RESULT_VAR)
|
|
|
|
# Check if the lua interpreter at the given path
|
|
|
|
# satisfies all Neovim dependencies
|
2018-10-06 09:45:34 -07:00
|
|
|
message(STATUS "Checking Lua interpreter: ${LUA_PRG_PATH}")
|
2014-07-11 04:12:10 -07:00
|
|
|
if(NOT EXISTS ${LUA_PRG_PATH})
|
|
|
|
message(STATUS
|
|
|
|
"[${LUA_PRG_PATH}] file not found")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
foreach(module ${MODULES})
|
|
|
|
check_lua_module(${LUA_PRG_PATH} ${module} has_module)
|
|
|
|
if(NOT has_module)
|
2016-05-07 19:06:46 -07:00
|
|
|
message(STATUS
|
|
|
|
"[${LUA_PRG_PATH}] The '${module}' lua package is required for building Neovim")
|
2014-07-11 04:12:10 -07:00
|
|
|
set(${RESULT_VAR} False PARENT_SCOPE)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set(${RESULT_VAR} True PARENT_SCOPE)
|
|
|
|
endfunction()
|