Rename Country column to "Country / Region"
[qBittorrent.git] / src / CMakeLists.txt
blob1a9975a99f4e939234cace7ce7c13d6baa30d1bb
1 set(CMAKE_CXX_STANDARD_REQUIRED True)
3 # If C++14 is available, use it as libtorent ABI depends on 11/14 version
4 if (cxx_std_14 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
5     message(STATUS "Building in C++14 mode")
6     set(CMAKE_CXX_STANDARD "14")
7 else()
8     message(STATUS "Building in C++11 mode")
9     set(CMAKE_CXX_STANDARD "11")
10 endif()
12 include(MacroQbtCompilerSettings)
13 qbt_set_compiler_options()
15 include(QbtTargetSources)
17 find_package(Boost ${requiredBoostVersion} REQUIRED)
18 find_package(LibtorrentRasterbar ${requiredLibtorrentVersion} REQUIRED)
19 find_package(OpenSSL ${requiredOpensslVersion} REQUIRED)
21 if (Boost_VERSION VERSION_LESS 106000)
22     add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
23 endif()
25 find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml LinguistTools)
26 find_package(Qt5Widgets ${requiredQtVersion})
27 if (Qt5Widgets_FOUND)
28     find_package(Qt5DBus ${requiredQtVersion})
29 else()
30     add_definitions(-DDISABLE_GUI)
31 endif()
33 set_package_properties(Qt5Widgets PROPERTIES
34     DESCRIPTION "Set of components for creating classic desktop-style UIs for the Qt5 framework"
35     PURPOSE "Enables qBittorrent GUI. Unneeded for headless configuration."
36     TYPE OPTIONAL
39 set_package_properties(Qt5DBus PROPERTIES
40     DESCRIPTION "Qt5 module for inter-process communication over the D-Bus protocol"
41     PURPOSE "Enables communication with other system components (e.g. notification service) via D-Bus. "
42     TYPE RECOMMENDED
45 set(CMAKE_AUTOMOC True)
46 list(APPEND CMAKE_AUTORCC_OPTIONS -compress 9 -threshold 5)
47 if (APPLE)
48     # Workaround CMake bug (autogen does not pass required parameters to moc)
49     # Relevant issue: https://gitlab.kitware.com/cmake/cmake/issues/18041
50     list(APPEND CMAKE_AUTOMOC_MOC_OPTIONS -DQ_OS_MACOS -DQ_OS_DARWIN)
51 endif ()
53 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
55 # defines
56 add_definitions(-DQT_DEPRECATED_WARNINGS)
57 add_definitions(-DQT_NO_CAST_TO_ASCII)
58 add_definitions(-DQT_USE_QSTRINGBUILDER)
59 add_definitions(-DQT_STRICT_ITERATORS)
61 if (CMAKE_BUILD_TYPE MATCHES "Debug")
62     message(STATUS "Project is built in DEBUG mode.")
63 else()
64     message(STATUS "Project is built in RELEASE mode.")
65     message(STATUS "Disabling debug output.")
66     add_definitions(-DQT_NO_DEBUG_OUTPUT)
67 endif()
69 configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
71 add_subdirectory(app)
72 add_subdirectory(base)
74 if (Qt5Widgets_FOUND)
75     add_subdirectory(gui)
76 endif ()
78 if (WEBUI)
79     add_subdirectory(webui)
80 endif (WEBUI)