New SQLite Only Unbundled Option (#4983)

* New SQLite Only Unbundled Option

A new option to use an unbundled (external) SQLite but all other dependencies internal.

* Match Other Option Styles

Force the POCO_SQLITE_UNBUNDLED option to ON when POCO_UNBUNDLED is on. Switching to this style to match the rest of the Poco cmake options.
This commit is contained in:
Andrew Auclair
2025-08-12 02:47:20 -04:00
committed by GitHub
parent 8e295ca01d
commit 20c993b819
9 changed files with 22 additions and 12 deletions

View File

@@ -237,6 +237,13 @@ option(ENABLE_FUZZING
option(POCO_UNBUNDLED option(POCO_UNBUNDLED
"Set to OFF|ON (default is OFF) to control linking dependencies as external" OFF) "Set to OFF|ON (default is OFF) to control linking dependencies as external" OFF)
option(POCO_SQLITE_UNBUNDLED
"Set to OFF|ON (default is OFF) to control linking sqlite dependency as external" OFF)
if (POCO_UNBUNDLED)
set(POCO_SQLITE_UNBUNDLED ON CACHE BOOL "Enable Unbundled SQLite" FORCE)
endif()
if(ENABLE_TESTS) if(ENABLE_TESTS)
include(CTest) include(CTest)
enable_testing() enable_testing()
@@ -267,6 +274,9 @@ endif()
if(POCO_UNBUNDLED) if(POCO_UNBUNDLED)
message(STATUS "Using external sqlite, zlib, pcre2, expat, libpng, ...") message(STATUS "Using external sqlite, zlib, pcre2, expat, libpng, ...")
elseif (POCO_SQLITE_UNBUNDLED)
message(STATUS "Using external sqlite")
message(STATUS "Using internal zlib, pcre2, expat, libpng, ...")
else() else()
message(STATUS "Using internal sqlite, zlib, pcre2, expat, libpng, ...") message(STATUS "Using internal sqlite, zlib, pcre2, expat, libpng, ...")
endif() endif()

View File

@@ -6,7 +6,7 @@ POCO_SOURCES_AUTO(SQLITE_SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h") file(GLOB_RECURSE HDRS_G "include/*.h")
POCO_HEADERS_AUTO(SQLITE_SRCS ${HDRS_G}) POCO_HEADERS_AUTO(SQLITE_SRCS ${HDRS_G})
if(POCO_UNBUNDLED) if(POCO_SQLITE_UNBUNDLED)
find_package(SQLite3 REQUIRED) find_package(SQLite3 REQUIRED)
else() else()
# sqlite3 # sqlite3
@@ -38,10 +38,10 @@ target_include_directories(DataSQLite
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
if(POCO_UNBUNDLED) if(POCO_SQLITE_UNBUNDLED)
target_link_libraries(DataSQLite PUBLIC SQLite::SQLite3) target_link_libraries(DataSQLite PUBLIC SQLite::SQLite3)
target_compile_definitions(DataSQLite PUBLIC target_compile_definitions(DataSQLite PUBLIC POCO_SQLITE_UNBUNDLED)
POCO_UNBUNDLED target_compile_definitions(DataSQLite PRIVATE
SQLITE_THREADSAFE=1 SQLITE_THREADSAFE=1
) )
else() else()

View File

@@ -19,7 +19,7 @@ ifdef POCO_ENABLE_SQLITE_FTS5
SYSFLAGS += -DSQLITE_ENABLE_FTS5 SYSFLAGS += -DSQLITE_ENABLE_FTS5
endif endif
ifdef POCO_UNBUNDLED ifdef POCO_SQLITE_UNBUNDLED
SYSLIBS += -lsqlite3 SYSLIBS += -lsqlite3
else else
objects += sqlite3 objects += sqlite3

View File

@@ -1,7 +1,7 @@
include(CMakeFindDependencyMacro) include(CMakeFindDependencyMacro)
find_dependency(PocoFoundation) find_dependency(PocoFoundation)
find_dependency(PocoData) find_dependency(PocoData)
if(@POCO_UNBUNDLED@) if(@POCO_SQLITE_UNBUNDLED@)
if(CMAKE_VERSION VERSION_LESS "3.14") if(CMAKE_VERSION VERSION_LESS "3.14")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/V313") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/V313")
endif() endif()

View File

@@ -15,7 +15,7 @@
#include "Poco/Data/SQLite/Connector.h" #include "Poco/Data/SQLite/Connector.h"
#include "Poco/Data/SQLite/SessionImpl.h" #include "Poco/Data/SQLite/SessionImpl.h"
#include "Poco/Data/SessionFactory.h" #include "Poco/Data/SessionFactory.h"
#if defined(POCO_UNBUNDLED) #if defined(POCO_SQLITE_UNBUNDLED)
#include <sqlite3.h> #include <sqlite3.h>
#else #else
#include "sqlite3.h" #include "sqlite3.h"

View File

@@ -21,7 +21,7 @@
#include "Poco/DateTimeParser.h" #include "Poco/DateTimeParser.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include "Poco/Debugger.h" #include "Poco/Debugger.h"
#if defined(POCO_UNBUNDLED) #if defined(POCO_SQLITE_UNBUNDLED)
#include <sqlite3.h> #include <sqlite3.h>
#else #else
#include "sqlite3.h" #include "sqlite3.h"

View File

@@ -18,7 +18,7 @@
#include "Poco/String.h" #include "Poco/String.h"
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#if defined(POCO_UNBUNDLED) #if defined(POCO_SQLITE_UNBUNDLED)
#include <sqlite3.h> #include <sqlite3.h>
#else #else
#include "sqlite3.h" #include "sqlite3.h"

View File

@@ -21,7 +21,7 @@
#include "Poco/String.h" #include "Poco/String.h"
#include "Poco/Mutex.h" #include "Poco/Mutex.h"
#include "Poco/Data/DataException.h" #include "Poco/Data/DataException.h"
#if defined(POCO_UNBUNDLED) #if defined(POCO_SQLITE_UNBUNDLED)
#include <sqlite3.h> #include <sqlite3.h>
#else #else
#include "sqlite3.h" #include "sqlite3.h"

View File

@@ -20,7 +20,7 @@
#include "Poco/String.h" #include "Poco/String.h"
#include "Poco/Any.h" #include "Poco/Any.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#if defined(POCO_UNBUNDLED) #if defined(POCO_SQLITE_UNBUNDLED)
#include <sqlite3.h> #include <sqlite3.h>
#else #else
#include "sqlite3.h" #include "sqlite3.h"