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