# ============================================================================== # Findsqlite3.cmake # ============================================================================== # This module fetches and builds the SQLite amalgamation as a static library. # # Targets provided: # sqlite3::sqlite3 - The SQLite static library target # # Variables set: # sqlite3_FOUND - TRUE if sqlite3 is available # sqlite3_LIBRARIES - The sqlite3 library target (sqlite3::sqlite3) # sqlite3_INCLUDE_DIR - Include directory for sqlite3.h # sqlite3_VERSION - Version of sqlite3 # ============================================================================== if (DEFINED _FINDSQLITE3_INCLUDED) return() endif() set(_FINDSQLITE3_INCLUDED TRUE) set(SQLITE3_VERSION "3.52.0") message(STATUS "Fetching sqlite3 ${SQLITE3_VERSION}") include(FetchContent) FetchContent_Declare( sqlite3_amalgamation URL https://sqlite.org/2026/sqlite-amalgamation-3520000.zip URL_HASH SHA3_256=3fab435106250ea1cdfd5f9fa1657ad832fd431df1d817d48af66ba166e0d16e DOWNLOAD_EXTRACT_TIMESTAMP TRUE ) FetchContent_MakeAvailable(sqlite3_amalgamation) if (NOT TARGET sqlite3::sqlite3) add_library(sqlite3 STATIC ${sqlite3_amalgamation_SOURCE_DIR}/sqlite3.c) target_include_directories(sqlite3 PUBLIC ${sqlite3_amalgamation_SOURCE_DIR}) target_link_libraries(sqlite3 PRIVATE ${CMAKE_DL_LIBS}) add_library(sqlite3::sqlite3 ALIAS sqlite3) endif() set(sqlite3_FOUND TRUE) set(sqlite3_LIBRARIES sqlite3::sqlite3) set(sqlite3_VERSION "${SQLITE3_VERSION}") set(sqlite3_INCLUDE_DIR "${sqlite3_amalgamation_SOURCE_DIR}")