Merge pull request #11539 from sledgehammer999/nsis_min_winVer
[qBittorrent.git] / CMakeLists.txt
blob6af87a74551adf4f22bbd12762cd80f9fe0e096d
1 cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
3 message(AUTHOR_WARNING "If the build fails, please try the autotools/qmake method.")
5 if(POLICY CMP0074)
6     cmake_policy(SET CMP0074 NEW)
7 endif()
9 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
10 include(FunctionReadVersion)
12 read_version("${CMAKE_CURRENT_SOURCE_DIR}/version.pri" VER_MAJOR VER_MINOR VER_BUGFIX VER_BUILD VER_STATUS)
13 # message(STATUS "Project version is: ${VER_MAJOR}.${VER_MINOR}.${VER_BUGFIX}.${VER_BUILD} (${VER_STATUS})")
15 project(qBittorrent VERSION ${VER_MAJOR}.${VER_MINOR}.${VER_BUGFIX}.${VER_BUILD})
17 set(PROJECT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUGFIX}")
19 if (NOT VER_BUILD EQUAL 0)
20     set(PROJECT_VERSION "${PROJECT_VERSION}.${VER_BUILD}")
21 endif()
23 set(PROJECT_VERSION "${PROJECT_VERSION}${VER_STATUS}")
25 add_definitions(-DQBT_VERSION_MAJOR=${VER_MAJOR})
26 add_definitions(-DQBT_VERSION_MINOR=${VER_MINOR})
27 add_definitions(-DQBT_VERSION_BUGFIX=${VER_BUGFIX})
28 add_definitions(-DQBT_VERSION_BUILD=${VER_BUILD})
30 add_definitions(-DQBT_VERSION="v${PROJECT_VERSION}")
31 add_definitions(-DQBT_VERSION_2="${PROJECT_VERSION}")
33 include(GNUInstallDirs)
34 include(FeatureSummary)
36 # version requirements
37 set(requiredBoostVersion 1.40)
38 set(requiredQtVersion 5.9.0)
39 set(requiredOpensslVersion 1.0)
40 set(requiredLibtorrentVersion 1.1.10)
42 if(WIN32)
43     include(winconf)
44 endif(WIN32)
47 # we need options here, at the top level, because they are used not only in "src" subdir, but in the "dist" dir too
48 include(CompileFeature)
50 optional_compile_definitions(COUNTRIES_RESOLUTION FEATURE DESCRIPTION "Enable resolving peers IP addresses to countries"
51     DEFAULT ON DISABLED DISABLE_COUNTRIES_RESOLUTION)
52 optional_compile_definitions(STACKTRACE FEATURE DESCRIPTION "Enable stacktraces"
53     DEFAULT ON ENABLED STACKTRACE)
54 optional_compile_definitions(WEBUI FEATURE DESCRIPTION "Enables built-in HTTP server for headless use"
55     DEFAULT ON DISABLED DISABLE_WEBUI)
57 add_subdirectory(src)
58 add_subdirectory(dist)
60 feature_summary(DESCRIPTION "\nConfiguration results:" WHAT ALL)