Merge pull request #17125 from sledgehammer999/cmake_lupdate
[qBittorrent.git] / CMakeLists.txt
blob4c6ffc889ba854f18eb909687de2b27f7ffd04d9
1 cmake_minimum_required(VERSION 3.16 FATAL_ERROR) # Policies <= CMP0097 default to NEW
3 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
5 project(qBittorrent
6     DESCRIPTION "The qBittorrent BitTorrent client"
7     HOMEPAGE_URL "https://www.qbittorrent.org/"
8     LANGUAGES CXX
11 # use CONFIG mode first in find_package
12 set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
13 # version requirements - older versions may work, but you are on your own
14 set(minBoostVersion 1.71)
15 set(minQt5Version 5.15.2)
16 set(minQt6Version 6.2)
17 set(minOpenSSLVersion 1.1.1)
18 set(minLibtorrent1Version 1.2.14)
19 set(minLibtorrentVersion 2.0.4)
20 set(minZlibVersion 1.2.11)
22 # features (some are platform-specific)
23 include(CheckCXXSourceCompiles) # TODO: migrate to CheckSourceCompiles in CMake >= 3.19
24 include(FeatureSummary)
25 include(FeatureOptionsSetup)
26 feature_option(QT6 "Use Qt6" OFF)
27 feature_option(STACKTRACE "Enable stacktraces" ON)
28 feature_option(GUI "Build GUI application" ON)
29 feature_option(WEBUI "Enables built-in HTTP server for headless use" ON)
30 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)
31 if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
32     feature_option_dependent(DBUS
33         "Enables support for notifications and power-management features on Linux via D-Bus"
34         ON "GUI" OFF
35     )
36     feature_option_dependent(SYSTEMD
37         "Install systemd service file to a directory manually overridable with SYSTEMD_SERVICES_INSTALL_DIR"
38         OFF "NOT GUI" OFF
39     )
40 elseif (MSVC)
41     feature_option(MSVC_RUNTIME_DYNAMIC "Use MSVC dynamic runtime library (-MD) instead of static (-MT)" ON)
42 endif()
44 include(GNUInstallDirs)
45 add_subdirectory(src)
46 add_subdirectory(dist)
48 if (VERBOSE_CONFIGURE)
49     feature_summary(WHAT ALL)
50 else()
51     feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
52 endif()
54 # Generate version header
55 configure_file("src/base/version.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/base/version.h" @ONLY)