cmake: Migrate away from deprecated SQLite3 target

CMake version 4.3 deprecated the imported target `Sqlite::Sqlite3`.
Use the preferred name `Sqlite3::Sqlite3` instead and provide an
alias for older versions of CMake. Also define the same alias when
using vcpkg.

Github-Pull: #34848
Rebased-From: 498b6eb6b5
This commit is contained in:
Daniel Pfeifer
2026-03-18 10:43:28 +01:00
committed by fanquake
parent 8d6ebc80ce
commit 0fb5e167e8
2 changed files with 5 additions and 2 deletions

View File

@@ -111,8 +111,12 @@ if(WITH_SQLITE)
if(VCPKG_TARGET_TRIPLET)
# Use of the `unofficial::` namespace is a vcpkg package manager convention.
find_package(unofficial-sqlite3 CONFIG REQUIRED)
add_library(SQLite3::SQLite3 ALIAS unofficial::sqlite3::sqlite3)
else()
find_package(SQLite3 3.7.17 REQUIRED)
if(NOT TARGET SQLite3::SQLite3) # CMake < 4.3
add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3)
endif()
endif()
set(USE_SQLITE ON)
endif()

View File

@@ -49,8 +49,7 @@ if(USE_SQLITE)
target_sources(bitcoin_wallet PRIVATE sqlite.cpp)
target_link_libraries(bitcoin_wallet
PRIVATE
$<TARGET_NAME_IF_EXISTS:unofficial::sqlite3::sqlite3>
$<TARGET_NAME_IF_EXISTS:SQLite::SQLite3>
SQLite3::SQLite3
)
endif()
if(USE_BDB)