Fix some warnings
[qBittorrent.git] / src / CMakeLists.txt
blob71435f360a204fb10c71478544c788bff8d5071d
1 set(CMAKE_CXX_STANDARD_REQUIRED True)
2 set(CMAKE_CXX_STANDARD "11")
4 include(MacroQbtCompilerSettings)
5 qbt_set_compiler_options()
7 include(QbtTargetSources)
9 find_package(Boost ${requiredBoostVersion} REQUIRED)
10 find_package(LibtorrentRasterbar REQUIRED)
12 if (Boost_VERSION VERSION_LESS 106000)
13     add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
14 endif()
16 find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml)
17 find_package(Qt5Widgets ${requiredQtVersion})
18 if (Qt5Widgets_FOUND)
19     find_package(Qt5DBus ${requiredQtVersion})
20 else()
21     add_definitions(-DDISABLE_GUI)
22 endif()
24 set_package_properties(Qt5Widgets PROPERTIES
25     DESCRIPTION "Set of components for creating classic desktop-style UIs for the Qt5 framework"
26     PURPOSE "Enables qBittorrent GUI. Unneeded for headless configuration."
27     TYPE OPTIONAL
30 set_package_properties(Qt5DBus PROPERTIES
31     DESCRIPTION "Qt5 module for inter-process communication over the D-Bus protocol"
32     PURPOSE "Enables communication with other system components (e.g. notification service) via D-Bus. "
33     TYPE RECOMMENDED
36 set(CMAKE_AUTOMOC True)
37 list(APPEND CMAKE_AUTORCC_OPTIONS -compress 9 -threshold 5)
38 if (APPLE)
39     # Workaround CMake bug (autogen does not pass required parameters to moc)
40     # Relevant issue: https://gitlab.kitware.com/cmake/cmake/issues/18041
41     list(APPEND CMAKE_AUTOMOC_MOC_OPTIONS -DQ_OS_MAC -DQ_OS_DARWIN)
42 endif ()
44 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
46 # defines
47 add_definitions(-DQT_NO_CAST_TO_ASCII)
48 # Efficient construction for QString & QByteArray (Qt >= 4.8)
49 add_definitions(-DQT_USE_QSTRINGBUILDER)
51 if (CMAKE_BUILD_TYPE MATCHES "Debug")
52     message(STATUS "Project is built in DEBUG mode.")
53 else()
54     message(STATUS "Project is built in RELEASE mode.")
55     message(STATUS "Disabling debug output.")
56     add_definitions(-DQT_NO_DEBUG_OUTPUT)
57 endif()
59 configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
61 find_package(QtSingleApplication)
62 set_package_properties(QtSingleApplication PROPERTIES
63     URL "https://code.qt.io/cgit/qt-solutions/qt-solutions.git/"
64     DESCRIPTION "Qt library to start applications only once per user"
65     TYPE RECOMMENDED
66     PURPOSE "Use the system qtsingleapplication library or shipped one otherwise"
69 if (NOT QtSingleApplication_FOUND)
70     add_subdirectory(app/qtsingleapplication)
71 endif ()
73 add_subdirectory(app)
74 add_subdirectory(base)
76 if (Qt5Widgets_FOUND)
77     add_subdirectory(gui)
78 endif ()
80 if (WEBUI)
81     add_subdirectory(webui)
82 endif (WEBUI)