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