Added support for .ini files (iniparser). (0.34.0)
This commit is contained in:
parent
49261b96c2
commit
fb5670a699
18 changed files with 710 additions and 5 deletions
|
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
project(fun VERSION 0.33.0 LANGUAGES C)
|
||||
project(fun VERSION 0.34.0 LANGUAGES C)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
|
@ -90,6 +90,36 @@ if(FUN_WITH_JSON)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# Optional INI (iniparser 4.2.6) support
|
||||
option(FUN_WITH_INI "Enable INI (iniparser) support" OFF)
|
||||
set(INIPARSER_INCLUDE_DIRS "")
|
||||
set(INIPARSER_LINK_LIBS "")
|
||||
if(FUN_WITH_INI)
|
||||
message(STATUS "Building with INI (iniparser) support")
|
||||
add_definitions(-DFUN_WITH_INI)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(INIPARSER QUIET iniparser)
|
||||
endif()
|
||||
if(INIPARSER_FOUND)
|
||||
list(APPEND INIPARSER_INCLUDE_DIRS ${INIPARSER_INCLUDE_DIRS} ${INIPARSER_INCLUDE_DIRS})
|
||||
list(APPEND INIPARSER_LINK_LIBS ${INIPARSER_LINK_LIBS} ${INIPARSER_LIBRARIES})
|
||||
else()
|
||||
# Fallback: try to locate headers and library manually
|
||||
find_path(INIPARSER_INCLUDE_DIR iniparser.h)
|
||||
find_library(INIPARSER_LIB NAMES iniparser)
|
||||
if(INIPARSER_INCLUDE_DIR)
|
||||
list(APPEND INIPARSER_INCLUDE_DIRS ${INIPARSER_INCLUDE_DIR})
|
||||
endif()
|
||||
if(INIPARSER_LIB)
|
||||
list(APPEND INIPARSER_LINK_LIBS ${INIPARSER_LIB})
|
||||
endif()
|
||||
if(NOT INIPARSER_INCLUDE_DIRS OR NOT INIPARSER_LINK_LIBS)
|
||||
message(FATAL_ERROR "iniparser not found. Install iniparser (>=4.2.6) or disable FUN_WITH_INI.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Optional libsql support (independent from SQLite)
|
||||
option(FUN_WITH_LIBSQL "Enable libsql (Turso) client support" OFF)
|
||||
set(LIBSQL_INCLUDE_DIRS "")
|
||||
|
|
@ -235,6 +265,14 @@ if(SQLITE3_LINK_LIBS)
|
|||
target_link_libraries(fun_core PUBLIC ${SQLITE3_LINK_LIBS})
|
||||
endif()
|
||||
|
||||
# iniparser include and link (if enabled)
|
||||
if(INIPARSER_INCLUDE_DIRS)
|
||||
target_include_directories(fun_core PRIVATE ${INIPARSER_INCLUDE_DIRS})
|
||||
endif()
|
||||
if(INIPARSER_LINK_LIBS)
|
||||
target_link_libraries(fun_core PUBLIC ${INIPARSER_LINK_LIBS})
|
||||
endif()
|
||||
|
||||
# libsql include and link (if enabled)
|
||||
if(LIBSQL_INCLUDE_DIRS)
|
||||
target_include_directories(fun_core PRIVATE ${LIBSQL_INCLUDE_DIRS})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue