1 cmake_minimum_required(VERSION 3.5)
2 cmake_policy(VERSION 3.5)
4 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
5 include(FunctionReadVersion)
7 read_version("${CMAKE_CURRENT_SOURCE_DIR}/version.pri" VER_MAJOR VER_MINOR VER_BUGFIX VER_BUILD VER_STATUS)
8 # message(STATUS "Project version is: ${VER_MAJOR}.${VER_MINOR}.${VER_BUGFIX}.${VER_BUILD} (${VER_STATUS})")
10 project(qBittorrent VERSION ${VER_MAJOR}.${VER_MINOR}.${VER_BUGFIX}.${VER_BUILD})
12 set(PROJECT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUGFIX}")
14 if (NOT VER_BUILD EQUAL 0)
15 set(PROJECT_VERSION "${PROJECT_VERSION}.${VER_BUILD}")
18 set(PROJECT_VERSION "${PROJECT_VERSION}${VER_STATUS}")
20 add_definitions(-DQBT_VERSION_MAJOR=${VER_MAJOR})
21 add_definitions(-DQBT_VERSION_MINOR=${VER_MINOR})
22 add_definitions(-DQBT_VERSION_BUGFIX=${VER_BUGFIX})
23 add_definitions(-DQBT_VERSION_BUILD=${VER_BUILD})
26 # DEFINES += DQBT_VERSION=\'\"v$${PROJECT_VERSION}\"\'
27 # DEFINES += DQBT_VERSION_2=\'\"$${PROJECT_VERSION}\"\'
29 add_definitions(-DQBT_VERSION="v${PROJECT_VERSION}")
30 add_definitions(-DQBT_VERSION_2="${PROJECT_VERSION}")
33 # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og")
34 if (UNIX AND NOT APPLE)
35 include(GNUInstallDirs)
36 endif (UNIX AND NOT APPLE)
42 # we need options here, because they are used not only in "src" subdir, but in the "dist" dir too
43 include(CMakeDependentOption)
45 option(SYSTEM_QTSINGLEAPPLICATION
46 "Use the system qtsingleapplication library or shipped one otherwise")
48 option(GUI "Allows to disable GUI for headless running. Disables QtDBus and the GeoIP Database" ON)
50 option(WEBUI "Allows to disable the WebUI." ON)
53 option(STACKTRACE_WIN "")
55 cmake_dependent_option(SYSTEMD "Install the systemd service file (headless only)" OFF
57 cmake_dependent_option(DBUS "Enable use of QtDBus (GUI only)" ON "GUI" OFF)
62 add_subdirectory(dist)