Sync translations from Transifex and run lupdate
[qBittorrent.git] / CMakeLists.txt
blobb05230a120b0bdb6d1359a9beec48650e686f68c
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     VERSION 4.4.0.0
7     DESCRIPTION "The qBittorrent BitTorrent client"
8     HOMEPAGE_URL "https://www.qbittorrent.org/"
9     LANGUAGES CXX
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"
32         ON "GUI" OFF
33     )
34     feature_option_dependent(SYSTEMD
35         "Install systemd service file to a directory manually overridable with Systemd_SERVICES_INSTALL_DIR"
36         OFF "NOT GUI" OFF
37     )
38     if (STACKTRACE)
39         check_cxx_source_compiles(
40             "#include <execinfo.h>
41             int main(){return 0;}"
42             QBITTORRENT_HAS_EXECINFO_H
43         )
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)."
47             )
48         endif()
49     endif()
50 elseif (MSVC)
51     feature_option(MSVC_RUNTIME_DYNAMIC "Use MSVC dynamic runtime library (-MD) instead of static (-MT)" ON)
52 endif()
54 set(QBT_VER_STATUS "alpha1" CACHE STRING "Project status version. Should be empty for release builds.")
56 include(GNUInstallDirs)
57 add_subdirectory(src)
58 add_subdirectory(dist)
60 if (VERBOSE_CONFIGURE)
61     feature_summary(WHAT ALL)
62 else()
63     feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
64 endif()