Bump to 4.6.5
[qBittorrent.git] / CMakeLists.txt
blob9c833f90b8451dd7a3101d5b4fe8f16ce8033115
1 cmake_minimum_required(VERSION 3.16 FATAL_ERROR) # Policies <= CMP0097 default to NEW
3 project(qBittorrent
4     DESCRIPTION "The qBittorrent BitTorrent client"
5     HOMEPAGE_URL "https://www.qbittorrent.org/"
6     LANGUAGES CXX
9 # version requirements - older versions may work, but you are on your own
10 set(minBoostVersion 1.71)
11 set(minQt5Version 5.15.2)
12 set(minQt6Version 6.2)
13 set(minOpenSSLVersion 1.1.1)
14 set(minLibtorrent1Version 1.2.19)
15 set(minLibtorrentVersion 2.0.9)
16 set(minZlibVersion 1.2.11)
18 include(CheckCXXSourceCompiles) # TODO: migrate to CheckSourceCompiles in CMake >= 3.19
19 include(GNUInstallDirs)
21 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
22 include(FeatureSummary)
23 include(FeatureOptionsSetup)
25 # features, list is loosely sorted by user's interests
26 feature_option(GUI "Build GUI application" ON)
27 feature_option(WEBUI "Enable built-in HTTP server for remote control" ON)
28 feature_option(QT6 "Build with Qt 6 instead of Qt 5" OFF)
29 feature_option(STACKTRACE "Enable stacktrace support" ON)
30 feature_option(TESTING "Build internal testing suite" OFF)
31 feature_option(VERBOSE_CONFIGURE "Show information about PACKAGES_FOUND and PACKAGES_NOT_FOUND in the configure output (only useful for debugging the CMake build scripts)" OFF)
33 if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
34     feature_option_dependent(DBUS
35         "Enable support for notifications and power-management features via D-Bus"
36         ON "GUI" OFF
37     )
38 endif()
40 if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
41     feature_option_dependent(SYSTEMD
42         "Install systemd service file. Target directory is overridable with `SYSTEMD_SERVICES_INSTALL_DIR` variable"
43         OFF "NOT GUI" OFF
44     )
45 endif()
47 if (MSVC)
48     feature_option(MSVC_RUNTIME_DYNAMIC "Use MSVC dynamic runtime library (-MD) instead of static (-MT)" ON)
49 endif()
51 if (VERBOSE_CONFIGURE)
52     feature_summary(WHAT ALL)
53 else()
54     feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
55 endif()
57 # go check the packages
58 include(CheckPackages)
59 # configure for specific platform
60 include(CommonConfig)
62 # Generate version header
63 configure_file("src/base/version.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/base/version.h" @ONLY)
65 add_subdirectory(src)
66 add_subdirectory(dist)
68 if (TESTING)
69     add_subdirectory(test)
70 endif()