Skip to content

Commit

Permalink
[FIXUP] for "cmake: Add wallet functionality"
Browse files Browse the repository at this point in the history
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
  • Loading branch information
hebasto committed Jul 17, 2023
1 parent 31e4e62 commit 769633e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 10 additions & 3 deletions cmake/optional.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,16 @@ endif()

if(ENABLE_WALLET)
if(WITH_SQLITE)
include(CrossPkgConfig)
cross_pkg_check_modules(sqlite sqlite3>=3.7.17 IMPORTED_TARGET)
if(sqlite_FOUND)
# TODO: Consider using the FindSQLite3 module after bumping
# the minimum required CMake version up to 3.14+.
if(MSVC)
# Use of the `unofficial::` namespace is a vcpkg package manager convention.
find_package(unofficial-sqlite3 CONFIG)
else()
include(CrossPkgConfig)
cross_pkg_check_modules(sqlite3 sqlite3>=3.7.17 IMPORTED_TARGET)
endif()
if(TARGET unofficial::sqlite3::sqlite3 OR TARGET PkgConfig::sqlite3)
set(WITH_SQLITE ON)
set(USE_SQLITE ON)
elseif(WITH_SQLITE STREQUAL "AUTO")
Expand Down
6 changes: 5 additions & 1 deletion src/wallet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ if(NOT USE_SQLITE AND NOT USE_BDB)
endif()
if(USE_SQLITE)
target_sources(bitcoin_wallet PRIVATE sqlite.cpp)
target_link_libraries(bitcoin_wallet PRIVATE PkgConfig::sqlite)
target_link_libraries(bitcoin_wallet
PRIVATE
$<TARGET_NAME_IF_EXISTS:unofficial::sqlite3::sqlite3>
$<TARGET_NAME_IF_EXISTS:PkgConfig::sqlite3>
)
endif()
if(USE_BDB)
target_sources(bitcoin_wallet PRIVATE bdb.cpp salvage.cpp)
Expand Down

0 comments on commit 769633e

Please sign in to comment.