From 677685cd374997834e12fbd54de9e24272fb6d8c Mon Sep 17 00:00:00 2001 From: Thomas Devoogdt Date: Fri, 28 Apr 2023 10:25:16 +0200 Subject: [PATCH] build: use the system provided LuaJIT if found e.g. buildroot has logic to build luajit, so if pkg_check_modules can find a suitable version, then use that one. Signed-off-by: Thomas Devoogdt --- CMakeLists.txt | 9 ++++++++- src/CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3e7a2585d7..6f55e8c1313 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1051,7 +1051,14 @@ endif() # LuaJIT (Scripting Support) # ========================== if(FLB_LUAJIT) - include(cmake/luajit.cmake) + find_package(PkgConfig) + pkg_check_modules(LUAJIT luajit>=2.1.0) + if(LUAJIT_FOUND) + include_directories(${LUAJIT_INCLUDE_DIRS}) + else() + include(cmake/luajit.cmake) + set(LUAJIT_LIBRARIES "libluajit") + endif() FLB_DEFINITION(FLB_HAVE_LUAJIT) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4f64613ecf0..ba876780c94 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -223,7 +223,7 @@ endif() if(FLB_LUAJIT) set(extra_libs ${extra_libs} - "libluajit") + ${LUAJIT_LIBRARIES}) endif() if(FLB_SQLDB)