Sync translations from Transifex and run lupdate
[qBittorrent.git] / src / CMakeLists.txt
blob7f3d3ec981b397bc7e0504f255a3bab9917b714d
1 if (UNIX AND (NOT APPLE) AND (NOT CYGWIN))
2     find_package(LibtorrentRasterbar QUIET ${requiredLibtorrentVersion} COMPONENTS torrent-rasterbar)
3     if (NOT LibtorrentRasterbar_FOUND)
4         include(FindPkgConfig)
5         pkg_check_modules(LIBTORRENT_RASTERBAR IMPORTED_TARGET GLOBAL "libtorrent-rasterbar>=${requiredLibtorrentVersion}")
6         if (NOT LIBTORRENT_RASTERBAR_FOUND)
7             message(
8                 FATAL_ERROR
9                 "Package LibtorrentRasterbar >= ${requiredLibtorrentVersion} not found"
10                 " with CMake or pkg-config.\n- Set LibtorrentRasterbar_DIR to a directory containing"
11                 " a LibtorrentRasterbarConfig.cmake file or add the installation prefix of LibtorrentRasterbar"
12                 " to CMAKE_PREFIX_PATH.\n- Alternatively, make sure there is a valid libtorrent-rasterbar.pc"
13                 " file in your system's pkg-config search paths (use the system environment variable PKG_CONFIG_PATH"
14                 " to specify additional search paths if needed)."
15             )
16         endif()
17         add_library(LibtorrentRasterbar::torrent-rasterbar ALIAS PkgConfig::LIBTORRENT_RASTERBAR)
18         # force a fake package to show up in the feature summary
19         set_property(GLOBAL APPEND PROPERTY
20             PACKAGES_FOUND
21             "LibtorrentRasterbar via pkg-config (required version >= ${requiredLibtorrentVersion})"
22         )
23         set_package_properties("LibtorrentRasterbar via pkg-config (required version >= ${requiredLibtorrentVersion})"
24             PROPERTIES
25             TYPE REQUIRED
26         )
27     else()
28         set_package_properties(LibtorrentRasterbar PROPERTIES TYPE REQUIRED)
29     endif()
30 else()
31     find_package(LibtorrentRasterbar ${requiredLibtorrentVersion} REQUIRED COMPONENTS torrent-rasterbar)
32 endif()
33 # force variable type so that it always shows up in ccmake/cmake-gui frontends
34 set_property(CACHE LibtorrentRasterbar_DIR PROPERTY TYPE PATH)
35 find_package(Boost ${requiredBoostVersion} REQUIRED)
36 find_package(OpenSSL ${requiredOpenSSLVersion} REQUIRED)
37 find_package(ZLIB ${requiredZlibVersion} REQUIRED)
38 find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml LinguistTools)
39 if (DBUS)
40     find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS DBus)
41     set_package_properties(Qt5DBus PROPERTIES
42         DESCRIPTION "Qt5 module for inter-process communication over the D-Bus protocol"
43         PURPOSE "Required by the DBUS feature"
44     )
45 endif()
47 # automatically call Qt moc, rcc and uic as needed for all targets by default
48 set(CMAKE_AUTORCC_OPTIONS --compress 9 --threshold 5)
49 set(CMAKE_AUTOMOC ON)
50 set(CMAKE_AUTORCC ON)
51 set(CMAKE_AUTOUIC ON)
53 # create interface-only target libraries with common compile options/definitions to link to
54 include(MacroQbtCommonConfig)
55 qbt_common_config()
57 # include directories - ideally, would be done per target instead of global directory scope
58 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
60 add_subdirectory(base)
62 if (GUI)
63     find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Widgets Svg)
64     if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
65         find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS MacExtras)
66     elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
67         find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS WinExtras)
68     endif()
69     add_subdirectory(gui)
70 endif()
72 if (WEBUI)
73     add_subdirectory(webui)
74 endif()
76 add_subdirectory(app)