CMakeLists.txt raw

   1  # Copyright (c) 2024-present The Bitcoin Core developers
   2  # Distributed under the MIT software license, see the accompanying
   3  # file COPYING or https://opensource.org/license/mit/.
   4  
   5  set(CMAKE_AUTOMOC_MOC_OPTIONS "-p${CMAKE_CURRENT_SOURCE_DIR}")
   6  
   7  add_executable(test_bitcoin-qt
   8    apptests.cpp
   9    optiontests.cpp
  10    rpcnestedtests.cpp
  11    test_main.cpp
  12    uritests.cpp
  13    util.cpp
  14    ../../init/bitcoin-qt.cpp
  15  )
  16  
  17  add_windows_application_manifest(test_bitcoin-qt)
  18  
  19  target_link_libraries(test_bitcoin-qt
  20    core_interface
  21    bitcoinqt
  22    test_util
  23    bitcoin_node
  24    Boost::headers
  25    Qt6::Test
  26  )
  27  
  28  import_plugins(test_bitcoin-qt)
  29  
  30  if(ENABLE_WALLET)
  31    target_sources(test_bitcoin-qt
  32      PRIVATE
  33        addressbooktests.cpp
  34        wallettests.cpp
  35        ../../wallet/test/wallet_test_fixture.cpp
  36    )
  37  endif()
  38  
  39  add_test(NAME test_bitcoin-qt
  40    COMMAND test_bitcoin-qt
  41  )
  42  if(WIN32 AND VCPKG_TARGET_TRIPLET)
  43    set(plugin_path "$<SHELL_PATH:$<PATH:GET_PARENT_PATH,$<PATH:GET_PARENT_PATH,$<TARGET_PROPERTY:Qt6::QWindowsIntegrationPlugin,LOCATION_$<CONFIG>>>>>")
  44    set_property(TEST test_bitcoin-qt APPEND PROPERTY
  45      ENVIRONMENT_MODIFICATION
  46        # On Windows, vcpkg configures Qt with `-opengl dynamic`, which makes
  47        # the "minimal" platform plugin unusable due to internal Qt bugs.
  48        QT_QPA_PLATFORM=set:windows
  49        QT_PLUGIN_PATH=set:${plugin_path}
  50    )
  51    unset(plugin_path)
  52  endif()
  53  
  54  install_binary_component(test_bitcoin-qt INTERNAL)
  55