From 20c993b8196fcea6ccc218cafaf5b4a4bd585610 Mon Sep 17 00:00:00 2001 From: Andrew Auclair Date: Tue, 12 Aug 2025 02:47:20 -0400 Subject: [PATCH] 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. --- CMakeLists.txt | 10 ++++++++++ Data/SQLite/CMakeLists.txt | 10 +++++----- Data/SQLite/Makefile | 2 +- Data/SQLite/cmake/PocoDataSQLiteConfig.cmake | 2 +- Data/SQLite/src/Connector.cpp | 2 +- Data/SQLite/src/Extractor.cpp | 2 +- Data/SQLite/src/SQLiteStatementImpl.cpp | 2 +- Data/SQLite/src/SessionImpl.cpp | 2 +- Data/SQLite/src/Utility.cpp | 2 +- 9 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1fd62ec5..d98adf903 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -237,6 +237,13 @@ option(ENABLE_FUZZING option(POCO_UNBUNDLED "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) include(CTest) enable_testing() @@ -267,6 +274,9 @@ endif() if(POCO_UNBUNDLED) 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() message(STATUS "Using internal sqlite, zlib, pcre2, expat, libpng, ...") endif() diff --git a/Data/SQLite/CMakeLists.txt b/Data/SQLite/CMakeLists.txt index 7141112e6..2a2d1174c 100644 --- a/Data/SQLite/CMakeLists.txt +++ b/Data/SQLite/CMakeLists.txt @@ -6,7 +6,7 @@ POCO_SOURCES_AUTO(SQLITE_SRCS ${SRCS_G}) file(GLOB_RECURSE HDRS_G "include/*.h") POCO_HEADERS_AUTO(SQLITE_SRCS ${HDRS_G}) -if(POCO_UNBUNDLED) +if(POCO_SQLITE_UNBUNDLED) find_package(SQLite3 REQUIRED) else() # sqlite3 @@ -38,10 +38,10 @@ target_include_directories(DataSQLite PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) -if(POCO_UNBUNDLED) - target_link_libraries(DataSQLite PUBLIC SQLite::SQLite3) - target_compile_definitions(DataSQLite PUBLIC - POCO_UNBUNDLED +if(POCO_SQLITE_UNBUNDLED) + target_link_libraries(DataSQLite PUBLIC SQLite::SQLite3) + target_compile_definitions(DataSQLite PUBLIC POCO_SQLITE_UNBUNDLED) + target_compile_definitions(DataSQLite PRIVATE SQLITE_THREADSAFE=1 ) else() diff --git a/Data/SQLite/Makefile b/Data/SQLite/Makefile index 52ba6a643..bebd44dd6 100644 --- a/Data/SQLite/Makefile +++ b/Data/SQLite/Makefile @@ -19,7 +19,7 @@ ifdef POCO_ENABLE_SQLITE_FTS5 SYSFLAGS += -DSQLITE_ENABLE_FTS5 endif -ifdef POCO_UNBUNDLED +ifdef POCO_SQLITE_UNBUNDLED SYSLIBS += -lsqlite3 else objects += sqlite3 diff --git a/Data/SQLite/cmake/PocoDataSQLiteConfig.cmake b/Data/SQLite/cmake/PocoDataSQLiteConfig.cmake index 5478bab1b..7b410282c 100644 --- a/Data/SQLite/cmake/PocoDataSQLiteConfig.cmake +++ b/Data/SQLite/cmake/PocoDataSQLiteConfig.cmake @@ -1,7 +1,7 @@ include(CMakeFindDependencyMacro) find_dependency(PocoFoundation) find_dependency(PocoData) -if(@POCO_UNBUNDLED@) +if(@POCO_SQLITE_UNBUNDLED@) if(CMAKE_VERSION VERSION_LESS "3.14") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/V313") endif() diff --git a/Data/SQLite/src/Connector.cpp b/Data/SQLite/src/Connector.cpp index 26aedcde5..8f0cb0b1c 100644 --- a/Data/SQLite/src/Connector.cpp +++ b/Data/SQLite/src/Connector.cpp @@ -15,7 +15,7 @@ #include "Poco/Data/SQLite/Connector.h" #include "Poco/Data/SQLite/SessionImpl.h" #include "Poco/Data/SessionFactory.h" -#if defined(POCO_UNBUNDLED) +#if defined(POCO_SQLITE_UNBUNDLED) #include #else #include "sqlite3.h" diff --git a/Data/SQLite/src/Extractor.cpp b/Data/SQLite/src/Extractor.cpp index 40f092ef3..e4b8e7548 100644 --- a/Data/SQLite/src/Extractor.cpp +++ b/Data/SQLite/src/Extractor.cpp @@ -21,7 +21,7 @@ #include "Poco/DateTimeParser.h" #include "Poco/Exception.h" #include "Poco/Debugger.h" -#if defined(POCO_UNBUNDLED) +#if defined(POCO_SQLITE_UNBUNDLED) #include #else #include "sqlite3.h" diff --git a/Data/SQLite/src/SQLiteStatementImpl.cpp b/Data/SQLite/src/SQLiteStatementImpl.cpp index ec3e469d9..ffa011cc1 100644 --- a/Data/SQLite/src/SQLiteStatementImpl.cpp +++ b/Data/SQLite/src/SQLiteStatementImpl.cpp @@ -18,7 +18,7 @@ #include "Poco/String.h" #include #include -#if defined(POCO_UNBUNDLED) +#if defined(POCO_SQLITE_UNBUNDLED) #include #else #include "sqlite3.h" diff --git a/Data/SQLite/src/SessionImpl.cpp b/Data/SQLite/src/SessionImpl.cpp index 333e5325f..4440a8891 100644 --- a/Data/SQLite/src/SessionImpl.cpp +++ b/Data/SQLite/src/SessionImpl.cpp @@ -21,7 +21,7 @@ #include "Poco/String.h" #include "Poco/Mutex.h" #include "Poco/Data/DataException.h" -#if defined(POCO_UNBUNDLED) +#if defined(POCO_SQLITE_UNBUNDLED) #include #else #include "sqlite3.h" diff --git a/Data/SQLite/src/Utility.cpp b/Data/SQLite/src/Utility.cpp index 6593e1bf4..64b76bb2c 100644 --- a/Data/SQLite/src/Utility.cpp +++ b/Data/SQLite/src/Utility.cpp @@ -20,7 +20,7 @@ #include "Poco/String.h" #include "Poco/Any.h" #include "Poco/Exception.h" -#if defined(POCO_UNBUNDLED) +#if defined(POCO_SQLITE_UNBUNDLED) #include #else #include "sqlite3.h"