Ignore file heath for 3rd party libraries
[qBittorrent.git] / CMakeLists.txt
blob909184245941bb5d2716e990e6bb2a78df218f25
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     DESCRIPTION "The qBittorrent BitTorrent client"
7     HOMEPAGE_URL "https://www.qbittorrent.org/"
8     LANGUAGES CXX
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.15.2)
16 set(minOpenSSLVersion 1.1.1)
17 set(minLibtorrent1Version 1.2.14)
18 set(minLibtorrentVersion 2.0.4)
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 include(GNUInstallDirs)
55 add_subdirectory(src)
56 add_subdirectory(dist)
58 if (VERBOSE_CONFIGURE)
59     feature_summary(WHAT ALL)
60 else()
61     feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
62 endif()
64 # Generate version header
65 configure_file("src/base/version.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/base/version.h" @ONLY)