Skip to content

Commit

Permalink
Merge #116: cmake: Add libqrencode optional package support
Browse files Browse the repository at this point in the history
593b130 cmake: Add `libqrencode` optional package support (Hennadii Stepanov)

Pull request description:

  A new configuration option `WITH_QRENCODE` has been added.

  This PR, along with #101, concludes the GUI-specific part of the new CMake-based build system.

ACKs for top commit:
  pablomartin4btc:
    tACK 593b130

Tree-SHA512: ba21d65ccff59e29585bd6ce092216034abcbd9866e5452fe6a1b1e2f0957dc3c48a204c170ce443888852ae165be7cb1846483b031b8cf49e6d986dec722f88
  • Loading branch information
hebasto committed Mar 13, 2024
2 parents 83374fd + 593b130 commit 5e65a38
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ tristate_option(WITH_EXTERNAL_SIGNER
"if Boost.Process is found."
AUTO
)
tristate_option(WITH_QRENCODE "Enable QR code support." "if libqrencode is found." AUTO)

option(BUILD_TESTS "Build test_bitcoin executable." ON)
cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "BUILD_TESTS" OFF)
Expand Down Expand Up @@ -479,6 +480,9 @@ message(" SQLite, descriptor wallets .......... ${WITH_SQLITE}")
message(" Berkeley DB, legacy wallets ......... ${WITH_BDB}")
message("Optional packages:")
message(" GUI ................................. ${WITH_GUI}")
if(WITH_GUI)
message(" QR code (GUI) ....................... ${WITH_QRENCODE}")
endif()
message(" external signer ..................... ${WITH_EXTERNAL_SIGNER}")
message(" NAT-PMP ............................. ${WITH_NATPMP}")
message(" UPnP ................................ ${WITH_MINIUPNPC}")
Expand Down
20 changes: 20 additions & 0 deletions cmake/optional.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,23 @@ else()
set(WITH_SQLITE OFF)
set(WITH_BDB OFF)
endif()

if(WITH_GUI AND WITH_QRENCODE)
if(MSVC)
# TODO: vcpkg fails to build libqrencode package due to
# the build error in its libiconv dependency.
# See: https://github.com/microsoft/vcpkg/issues/36924.
else()
cross_pkg_check_modules(libqrencode libqrencode IMPORTED_TARGET)
endif()
if(TARGET PkgConfig::libqrencode)
set_target_properties(PkgConfig::libqrencode PROPERTIES
INTERFACE_COMPILE_DEFINITIONS USE_QRCODE
)
set(WITH_QRENCODE ON)
elseif(WITH_QRENCODE STREQUAL "AUTO")
set(WITH_QRENCODE OFF)
else()
message(FATAL_ERROR "libqrencode requested, but not found.")
endif()
endif()
1 change: 1 addition & 0 deletions src/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ target_link_libraries(bitcoinqt
Boost::headers
$<TARGET_NAME_IF_EXISTS:NATPMP::NATPMP>
$<TARGET_NAME_IF_EXISTS:MiniUPnPc::MiniUPnPc>
$<TARGET_NAME_IF_EXISTS:PkgConfig::libqrencode>
$<$<PLATFORM_ID:Darwin>:-framework\ AppKit>
$<$<CXX_COMPILER_ID:MSVC>:shlwapi>
)
Expand Down

0 comments on commit 5e65a38

Please sign in to comment.