--- CMakeLists.txt.orig	2025-03-07 15:17:49 UTC
+++ CMakeLists.txt
@@ -29,24 +29,15 @@ endif()
     #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -pthread -s")
 endif()
 
-# Lua
-include(FetchContent)
-FetchContent_Declare(lua
-                     URL      https://www.lua.org/ftp/lua-5.4.7.tar.gz
-                     URL_HASH SHA256=9fbf5e28ef86c69858f6d3d34eccc32e911c1a28b4120ff3e84aaa70cfbf1e30
-                     DOWNLOAD_EXTRACT_TIMESTAMP true)
-FetchContent_MakeAvailable(lua)
-file(GLOB lua_src CONFIGURE_DEPENDS ${lua_SOURCE_DIR}/src/*.c)
-list(REMOVE_ITEM lua_src ${lua_SOURCE_DIR}/src/lua.c ${lua_SOURCE_DIR}/src/luac.c)
-add_library(lua ${lua_src})
-target_include_directories(lua PUBLIC ${lua_SOURCE_DIR}/src)
-target_sources(lua PRIVATE ${lua_src})
+find_package(PkgConfig)
 
+pkg_check_modules(LUA REQUIRED lua-5.4 IMPORTED_TARGET GLOBAL)
+
 add_executable(vtm "src/vtm.cpp" ${WIN32_RESOURCES})
 # add_executable(term "src/netxs/apps/term.cpp")
 # add_executable(calc "src/netxs/apps/calc.cpp")
 
-target_link_libraries(vtm lua)
+target_link_libraries(vtm ${LUA_LIBRARIES})
 # target_link_libraries(term lua)
 # target_link_libraries(calc lua)
 
