1
0
Fork 0
forked from fun/fun

Added SQLite support and updated the Handbook. (0.32.0)

This commit is contained in:
Johannes Findeisen 2025-11-26 22:21:31 +01:00
commit 9416ec3457
17 changed files with 631 additions and 388 deletions

View file

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(fun VERSION 0.31.0 LANGUAGES C)
project(fun VERSION 0.32.0 LANGUAGES C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
@ -26,7 +26,32 @@ else()
endif()
# Ensure trailing slash
if(NOT DEFAULT_LIB_DIR MATCHES "/$")
set(DEFAULT_LIB_DIR "${DEFAULT_LIB_DIR}/")
set(DEFAULT_LIB_DIR "${DEFAULT_LIB_DIR}/")
endif()
# Optional SQLite support
option(FUN_WITH_SQLITE "Enable SQLite (sqlite3) support" OFF)
set(SQLITE3_INCLUDE_DIRS "")
set(SQLITE3_LINK_LIBS "")
if(FUN_WITH_SQLITE)
message(STATUS "Building with SQLite support")
add_definitions(-DFUN_WITH_SQLITE)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(SQLITE3 QUIET sqlite3)
endif()
if(SQLITE3_FOUND)
list(APPEND SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIRS} ${SQLITE3_INCLUDE_DIRS})
list(APPEND SQLITE3_LINK_LIBS ${SQLITE3_LINK_LIBS} ${SQLITE3_LIBRARIES})
include_directories(${SQLITE3_INCLUDE_DIRS})
else()
find_library(SQLITE3_LIB sqlite3)
if(SQLITE3_LIB)
list(APPEND SQLITE3_LINK_LIBS ${SQLITE3_LIB})
else()
message(FATAL_ERROR "sqlite3 not found. Install sqlite3 (dev headers) or disable FUN_WITH_SQLITE.")
endif()
endif()
endif()
# Optional PCSC support (enabled via -DFUN_WITH_PCSC=ON)
@ -168,6 +193,14 @@ if(CURL_LINK_LIBS)
target_link_libraries(fun_core PUBLIC ${CURL_LINK_LIBS})
endif()
# sqlite3 include and link (if enabled)
if(SQLITE3_INCLUDE_DIRS)
target_include_directories(fun_core PRIVATE ${SQLITE3_INCLUDE_DIRS})
endif()
if(SQLITE3_LINK_LIBS)
target_link_libraries(fun_core PUBLIC ${SQLITE3_LINK_LIBS})
endif()
# Link threads if available on UNIX
if(Threads_FOUND)
target_link_libraries(fun_core PUBLIC Threads::Threads)