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
2020-10-19 13:49:46 +08:00
V E R S I O N 4 . 4 . 0 . 0
2020-05-04 02:28:07 +08:00
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 )
2020-12-04 20:16:04 +08:00
# version requirements - older vesions may work, but you are on your own
set ( minBoostVersion 1.65 )
set ( minQtVersion 5.9.5 )
set ( minOpenSSLVersion 1.1.1 )
set ( minLibtorrentVersion 1.2.11 )
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 )
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
" 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 "
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
set ( QBT_VER_STATUS "alpha1" CACHE STRING "Project status version. Should be empty for release builds." )
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 ( )