2020-05-03 19:28:07 +01:00
cmake_minimum_required(VERSION 3.16 FATAL_ERROR) # Policies <= CMP0097 default to NEW
2020-04-30 10:31:23 +01:00
2020-05-03 19:28:07 +01:00
project(qBittorrent
DESCRIPTION "The qBittorrent BitTorrent client"
HOMEPAGE_URL "https://www.qbittorrent.org/"
LANGUAGES CXX
)
2018-06-05 03:03:38 +02:00
2021-08-21 13:43:50 +00:00
# version requirements - older versions may work, but you are on your own
2023-08-08 23:33:02 +08:00
set(minBoostVersion 1.76)
2023-08-07 07:19:43 +03:00
set(minQt6Version 6.5.0)
2023-09-26 04:51:53 +01:00
set(minOpenSSLVersion 3.0.2)
2023-05-25 06:31:28 +03:00
set(minLibtorrent1Version 1.2.19)
2024-04-21 07:52:51 +01:00
set(minLibtorrentVersion 2.0.10)
2020-12-04 12:16:04 +00:00
set(minZlibVersion 1.2.11)
2015-11-06 19:03:18 +01:00
2022-07-10 13:20:27 +08:00
include(GNUInstallDirs)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
2020-05-03 19:28:07 +01:00
include(FeatureSummary)
include(FeatureOptionsSetup)
2022-07-10 13:20:27 +08:00
# features, list is loosely sorted by user's interests
2020-05-03 19:28:07 +01:00
feature_option(GUI "Build GUI application" ON)
2022-07-10 13:20:27 +08:00
feature_option(WEBUI "Enable built-in HTTP server for remote control" ON)
feature_option(STACKTRACE "Enable stacktrace support" ON)
feature_option(TESTING "Build internal testing suite" OFF)
2020-05-03 19:28:07 +01:00
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)
2022-07-10 13:20:27 +08:00
2023-09-05 01:23:50 -07:00
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
2020-05-03 19:28:07 +01:00
feature_option_dependent(DBUS
2023-09-05 01:23:50 -07:00
"Enable support for notifications and power-management features via D-Bus"
2020-05-03 19:28:07 +01:00
ON "GUI" OFF
)
2023-09-05 01:23:50 -07:00
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
2020-05-03 19:28:07 +01:00
feature_option_dependent(SYSTEMD
2022-07-10 13:20:27 +08:00
"Install systemd service file. Target directory is overridable with `SYSTEMD_SERVICES_INSTALL_DIR` variable"
2020-05-03 19:28:07 +01:00
OFF "NOT GUI" OFF
)
2023-09-05 01:23:50 -07:00
endif()
if (MSVC)
2020-09-27 00:02:56 +05:30
feature_option(MSVC_RUNTIME_DYNAMIC "Use MSVC dynamic runtime library (-MD) instead of static (-MT)" ON)
2020-04-30 11:34:41 +03:00
endif()
2015-11-06 19:03:18 +01:00
2020-05-03 19:28:07 +01:00
if (VERBOSE_CONFIGURE)
feature_summary(WHAT ALL)
else()
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
endif()
2021-01-07 02:07:10 +08:00
2022-07-10 13:20:27 +08:00
# go check the packages
include(CheckPackages)
# configure for specific platform
include(CommonConfig)
2021-01-07 02:07:10 +08:00
# Generate version header
2021-02-05 10:14:52 +08:00
configure_file("src/base/version.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/base/version.h" @ONLY)
2022-07-10 13:20:27 +08:00
add_subdirectory(src)
add_subdirectory(dist)
if (TESTING)
add_subdirectory(test)
endif()