1 set(CMAKE_CXX_STANDARD_REQUIRED True)
2 set(CMAKE_CXX_STANDARD "11")
4 include(MacroQbtCompilerSettings)
5 qbt_set_compiler_options()
7 include(QbtTargetSources)
9 find_package(Boost ${requiredBoostVersion} REQUIRED)
10 find_package(LibtorrentRasterbar REQUIRED)
12 if (Boost_VERSION VERSION_LESS 106000)
13 add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
16 find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml)
17 find_package(Qt5Widgets ${requiredQtVersion})
19 find_package(Qt5DBus ${requiredQtVersion})
21 add_definitions(-DDISABLE_GUI)
24 set_package_properties(Qt5Widgets PROPERTIES
25 DESCRIPTION "Set of components for creating classic desktop-style UIs for the Qt5 framework"
26 PURPOSE "Enables qBittorrent GUI. Unneeded for headless configuration."
30 set_package_properties(Qt5DBus PROPERTIES
31 DESCRIPTION "Qt5 module for inter-process communication over the D-Bus protocol"
32 PURPOSE "Enables communication with other system components (e.g. notification service) via D-Bus. "
36 set(CMAKE_AUTOMOC True)
37 list(APPEND CMAKE_AUTORCC_OPTIONS -compress 9 -threshold 5)
39 # Workaround CMake bug (autogen does not pass required parameters to moc)
40 # Relevant issue: https://gitlab.kitware.com/cmake/cmake/issues/18041
41 list(APPEND CMAKE_AUTOMOC_MOC_OPTIONS -DQ_OS_MAC -DQ_OS_DARWIN)
44 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
47 add_definitions(-DQT_NO_CAST_TO_ASCII)
48 # Efficient construction for QString & QByteArray (Qt >= 4.8)
49 add_definitions(-DQT_USE_QSTRINGBUILDER)
51 if (CMAKE_BUILD_TYPE MATCHES "Debug")
52 message(STATUS "Project is built in DEBUG mode.")
54 message(STATUS "Project is built in RELEASE mode.")
55 message(STATUS "Disabling debug output.")
56 add_definitions(-DQT_NO_DEBUG_OUTPUT)
59 configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
61 find_package(QtSingleApplication)
62 set_package_properties(QtSingleApplication PROPERTIES
63 URL "https://code.qt.io/cgit/qt-solutions/qt-solutions.git/"
64 DESCRIPTION "Qt library to start applications only once per user"
66 PURPOSE "Use the system qtsingleapplication library or shipped one otherwise"
69 if (NOT QtSingleApplication_FOUND)
70 add_subdirectory(app/qtsingleapplication)
74 add_subdirectory(base)
81 add_subdirectory(webui)