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)