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)
6 DESCRIPTION "The qBittorrent BitTorrent client"
7 HOMEPAGE_URL "https://www.qbittorrent.org/"
11 # use CONFIG mode first in find_package
12 set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
13 # version requirements - older vesions may work, but you are on your own
14 set(minBoostVersion 1.65)
15 set(minQtVersion 5.14)
16 set(minOpenSSLVersion 1.1.1)
17 set(minLibtorrentVersion 1.2.14)
18 set(minZlibVersion 1.2.11)
20 # features (some are platform-specific)
21 include(CheckCXXSourceCompiles) # TODO: migrate to CheckSourceCompiles in CMake >= 3.19
22 include(FeatureSummary)
23 include(FeatureOptionsSetup)
24 feature_option(STACKTRACE "Enable stacktraces" ON)
25 feature_option(GUI "Build GUI application" ON)
26 feature_option(WEBUI "Enables built-in HTTP server for headless use" ON)
27 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)
28 if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
29 feature_option_dependent(DBUS
30 "Enables support for notifications and power-management features on Linux via D-Bus"
33 feature_option_dependent(SYSTEMD
34 "Install systemd service file to a directory manually overridable with Systemd_SERVICES_INSTALL_DIR"
38 check_cxx_source_compiles(
39 "#include <execinfo.h>
40 int main(){return 0;}"
41 QBITTORRENT_HAS_EXECINFO_H
43 if (NOT QBITTORRENT_HAS_EXECINFO_H)
44 message(FATAL_ERROR "execinfo.h header file not found.\n"
45 "Please either disable the STACKTRACE feature or use a libc that has this header file, such as glibc (GNU libc)."
50 feature_option(MSVC_RUNTIME_DYNAMIC "Use MSVC dynamic runtime library (-MD) instead of static (-MT)" ON)
53 include(GNUInstallDirs)
55 add_subdirectory(dist)
57 if (VERBOSE_CONFIGURE)
58 feature_summary(WHAT ALL)
60 feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
63 # Generate version header
64 configure_file("src/base/version.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/base/version.h" @ONLY)