diff --git a/CMakeLists.txt b/CMakeLists.txt
index b746dd460e..782dc8c87a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -310,8 +310,15 @@ include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
 find_package(Msgpack 1.0.0 REQUIRED)
 include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
 
-find_package(LuaJit REQUIRED)
-include_directories(SYSTEM ${LUAJIT_INCLUDE_DIRS})
+option(PREFER_LUAJIT "Prefer LuaJIT over Lua." ON)
+
+if(PREFER_LUAJIT)
+  find_package(LuaJit REQUIRED)
+  include_directories(SYSTEM ${LUAJIT_INCLUDE_DIRS})
+else()
+  find_package(Lua REQUIRED)
+  include_directories(SYSTEM ${LUA_INCLUDE_DIR})
+endif()
 
 if(UNIX)
   option(FEAT_TUI "Enable the Terminal UI" ON)
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index a47a8e49c7..7a7dbbcce6 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -291,8 +291,12 @@ list(APPEND NVIM_LINK_LIBRARIES
   ${LIBTERMKEY_LIBRARIES}
   ${UNIBILIUM_LIBRARIES}
   ${CMAKE_THREAD_LIBS_INIT}
-  ${LUAJIT_LIBRARIES}
 )
+if(PREFER_LUAJIT)
+  list(APPEND NVIM_LINK_LIBRARIES ${LUAJIT_LIBRARIES})
+else()
+  list(APPEND NVIM_LINK_LIBRARIES ${LUA_LIBRARIES})
+endif()
 
 if(UNIX)
   list(APPEND NVIM_LINK_LIBRARIES