Skip to content

Commit

Permalink
build: use the system provided sqlite if found
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Devoogdt <[email protected]>
  • Loading branch information
ThomasDevoogdt committed Dec 15, 2024
1 parent f3d44eb commit ce6678e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ option(FLB_PREFER_SYSTEM_LIB_KAFKA "Prefer the libkafka system library"
option(FLB_PREFER_SYSTEM_LIB_LUAJIT "Prefer the libluajit system library" ${FLB_PREFER_SYSTEM_LIBS})
option(FLB_PREFER_SYSTEM_LIB_MSGPACK "Prefer the libmsgpack system library" ${FLB_PREFER_SYSTEM_LIBS})
option(FLB_PREFER_SYSTEM_LIB_NGHTTP2 "Prefer the libnghttp2 system library" ${FLB_PREFER_SYSTEM_LIBS})
option(FLB_PREFER_SYSTEM_LIB_SQLITE "Prefer the libsqlite3 system library" ${FLB_PREFER_SYSTEM_LIBS})

# Enable all features
if(FLB_ALL)
Expand Down Expand Up @@ -689,8 +690,17 @@ if (FLB_SIGNV4)
endif()

if(FLB_SQLDB)
if(FLB_PREFER_SYSTEM_LIB_SQLITE)
find_package(PkgConfig)
pkg_check_modules(SQLITE sqlite3>=3.0.0)
endif()
if(SQLITE_FOUND)
include_directories(${SQLITE_INCLUDE_DIRS})
link_directories(${SQLITE_LIBRARY_DIRS})
else()
include(cmake/sqlite.cmake)
endif()
FLB_DEFINITION(FLB_HAVE_SQLDB)
add_subdirectory(${FLB_PATH_LIB_SQLITE})
endif()

if(FLB_TRACE)
Expand Down
1 change: 0 additions & 1 deletion cmake/headers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ include_directories(
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_MONKEY}/include
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_MONKEY}/include/monkey
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_MBEDTLS}/include
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_SQLITE}
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_MPACK}/src
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_MINIZ}/
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_ONIGMO}
Expand Down
6 changes: 6 additions & 0 deletions cmake/sqlite.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# sqlite cmake
include_directories(
${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_SQLITE}
)
add_subdirectory(${FLB_PATH_LIB_SQLITE})
set(SQLITE_LIBRARIES "sqlite3")
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ if(FLB_SQLDB)
)
set(extra_libs
${extra_libs}
"sqlite3")
${SQLITE_LIBRARIES})
endif()

if(FLB_STATIC_CONF)
Expand Down

0 comments on commit ce6678e

Please sign in to comment.