diff --git a/CMakeLists.txt b/CMakeLists.txt index 918687f9d4..b3ed0f8640 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,12 +68,24 @@ endif(NOT CMAKE_USE_PTHREADS_INIT) 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() + +if(EXISTS ${LUA_PRG}) + message(STATUS "Using the lua interpreter ${LUA_PRG}") +else() + message(FATAL_ERROR "A lua interpreter is required for building the Neovim") +endif() + add_subdirectory(config) add_subdirectory(src) add_subdirectory(test/includes) find_program(BUSTED_PRG busted) -find_program(LUAJIT_PRG luajit) find_program(MAKE_PRG NAMES gmake make) if(MAKE_PRG) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8e38839e24..30d50bb8bc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,5 @@ include(CheckLibraryExists) -if(DEFINED ENV{LUA_BINARY}) - set(LUA_BIN $ENV{LUA_BINARY}) -else() - set(LUA_BIN ${DEPS_BIN_DIR}/luajit) -endif() - set(GENERATED_DIR ${PROJECT_BINARY_DIR}/src/auto) set(DISPATCH_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/msgpack-gen.lua) set(API_HEADER ${PROJECT_SOURCE_DIR}/src/api.h) @@ -15,7 +9,7 @@ set(MSGPACK_DISPATCH ${GENERATED_DIR}/msgpack_dispatch.c) file(MAKE_DIRECTORY ${GENERATED_DIR}) add_custom_command(OUTPUT ${MSGPACK_DISPATCH} - COMMAND ${LUA_BIN} ${DISPATCH_GENERATOR} ${API_HEADER} ${MSGPACK_DISPATCH} + COMMAND ${LUA_PRG} ${DISPATCH_GENERATOR} ${API_HEADER} ${MSGPACK_DISPATCH} DEPENDS ${API_HEADER} ${MSGPACK_RPC_HEADER}