diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e5510098c3db..7166ea8d22c4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,6 +159,23 @@ if(WITH_MULTIPROCESS) endif() cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "BUILD_GUI;BUILD_TESTS" OFF) +if(BUILD_GUI) + set(qt_components Core Gui Widgets LinguistTools) + if(ENABLE_WALLET) + list(APPEND qt_components Network) + endif() + if(WITH_DBUS) + list(APPEND qt_components DBus) + endif() + if(BUILD_GUI_TESTS) + list(APPEND qt_components Test) + endif() + find_package(Qt5 5.11.3 MODULE REQUIRED + COMPONENTS ${qt_components} + ) + unset(qt_components) +endif() + option(BUILD_BENCH "Build bench_bitcoin executable." OFF) option(BUILD_FUZZ_BINARY "Build fuzz binary." OFF) cmake_dependent_option(ENABLE_FUZZ "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF "NOT MSVC" OFF) diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index ccf3dfa30d6fd..279231340a4c5 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -2,21 +2,6 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. -set(qt_components Core Gui Widgets LinguistTools) -if(ENABLE_WALLET) - list(APPEND qt_components Network) -endif() -if(WITH_DBUS) - list(APPEND qt_components DBus) -endif() -if(BUILD_GUI_TESTS) - list(APPEND qt_components Test) -endif() -find_package(Qt5 5.11.3 MODULE REQUIRED - COMPONENTS ${qt_components} -) -unset(qt_components) - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") enable_language(OBJCXX) set(CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")