2020-05-04 02:28:07 +08:00
cmake_minimum_required ( VERSION 3.16 FATAL_ERROR ) # Policies <= CMP0097 default to NEW
2020-04-30 17:31:23 +08:00
2017-02-07 01:05:35 +08:00
list ( APPEND CMAKE_MODULE_PATH ${ CMAKE_CURRENT_SOURCE_DIR } /cmake/Modules )
2015-11-07 02:03:18 +08:00
2020-05-04 02:28:07 +08:00
project ( qBittorrent
D E S C R I P T I O N " T h e q B i t t o r r e n t B i t T o r r e n t c l i e n t "
H O M E P A G E _ U R L " h t t p s : / / w w w . q b i t t o r r e n t . o r g / "
L A N G U A G E S C X X
)
2018-06-05 09:03:38 +08:00
2020-05-04 02:28:07 +08:00
# use CONFIG mode first in find_package
set ( CMAKE_FIND_PACKAGE_PREFER_CONFIG ON )
2021-08-21 21:43:50 +08:00
# version requirements - older versions may work, but you are on your own
2020-12-04 20:16:04 +08:00
set ( minBoostVersion 1.65 )
2021-03-01 13:38:51 +08:00
set ( minQt5Version 5.15.2 )
set ( minQt6Version 6.2 )
2020-12-04 20:16:04 +08:00
set ( minOpenSSLVersion 1.1.1 )
2021-07-29 14:15:59 +08:00
set ( minLibtorrent1Version 1.2.14 )
set ( minLibtorrentVersion 2.0.4 )
2020-12-04 20:16:04 +08:00
set ( minZlibVersion 1.2.11 )
2015-11-07 02:03:18 +08:00
2020-05-04 02:28:07 +08:00
# features (some are platform-specific)
2020-12-07 03:17:58 +08:00
include ( CheckCXXSourceCompiles ) # TODO: migrate to CheckSourceCompiles in CMake >= 3.19
2020-05-04 02:28:07 +08:00
include ( FeatureSummary )
include ( FeatureOptionsSetup )
2021-03-01 13:38:51 +08:00
feature_option ( QT6 "Use Qt6" OFF )
2020-05-04 02:28:07 +08:00
feature_option ( STACKTRACE "Enable stacktraces" ON )
feature_option ( GUI "Build GUI application" ON )
feature_option ( WEBUI "Enables built-in HTTP server for headless use" ON )
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 )
if ( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
feature_option_dependent ( DBUS
" E n a b l e s s u p p o r t f o r n o t i f i c a t i o n s a n d p o w e r - m a n a g e m e n t f e a t u r e s o n L i n u x v i a D - B u s "
O N " G U I " O F F
)
feature_option_dependent ( SYSTEMD
2022-03-23 12:56:14 +08:00
" I n s t a l l s y s t e m d s e r v i c e f i l e t o a d i r e c t o r y m a n u a l l y o v e r r i d a b l e w i t h S Y S T E M D _ S E R V I C E S _ I N S T A L L _ D I R "
2020-05-04 02:28:07 +08:00
O F F " N O T G U I " O F F
)
2020-12-07 03:17:58 +08:00
if ( STACKTRACE )
check_cxx_source_compiles (
" #include <execinfo.h>
i n t main ( ) { r e t u r n 0 ; } "
Q B I T T O R R E N T _ H A S _ E X E C I N F O _ H
)
if ( NOT QBITTORRENT_HAS_EXECINFO_H )
message ( FATAL_ERROR "execinfo.h header file not found.\n"
" P l e a s e e i t h e r d i s a b l e t h e S T A C K T R A C E f e a t u r e o r u s e a l i b c t h a t h a s t h i s h e a d e r f i l e , s u c h a s glibc ( GNU libc ) . "
)
endif ( )
endif ( )
2020-05-04 02:28:07 +08:00
elseif ( MSVC )
2020-09-27 02:32:56 +08:00
feature_option ( MSVC_RUNTIME_DYNAMIC "Use MSVC dynamic runtime library (-MD) instead of static (-MT)" ON )
2020-04-30 16:34:41 +08:00
endif ( )
2015-11-07 02:03:18 +08:00
2020-05-04 02:28:07 +08:00
include ( GNUInstallDirs )
2015-11-07 02:03:18 +08:00
add_subdirectory ( src )
add_subdirectory ( dist )
2018-06-05 09:03:38 +08:00
2020-05-04 02:28:07 +08: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
# 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 )