Our previous setup lead to two unintended consequences:
* Debug flags were included in both release and debug builds instead
of just debug builds
* Clang doesn't support -gX (where X is the level of debugging
optimization), but we checked for -Og support instead
This commit avoids both of these scenarios by removing the additional
flags altogether. Partial resolution to #11856.
Qt translations have to be compiled in a shared library or executable,
and since we use static libraries for the components, webui translation
files have to be compiled into the main executable.
Look for qtsinglecoreapplication.h when Qt5Widgets module was not found,
and qtsingleapplication.h otherwise. Fixes#9196.
This also removes Qt4 support from the QtSingleApplication find module.
1. Use FeatureSummary module to show configuration results.
2. Invert option()/find_package() relationship: instead of
calling find_package(... REQUIRED) when option is set, rely on optional
find package call and PackageName_FOUND variable.
3. Refactor handling options that result in simple preprocessor defines
(actually copy the snippet from libtorrent) so that everything is done
in a single function call.
4. Populate target properties in order to get rid of
include_directories() calls.
Apparently, recent version of CMake made PkgConfig stuff scooped and we
need to call find_package(PkgConfig) in FindSystemd.cmake too, the call
in FindLibtorrentRasterbar.cmake, that is always used first, is not
enough now.
If libtorrent include directory not in the compiler search path, we have
to pass it to all qbt targets, because session.h includes
libtorrent/version.hpp
With pkg-config we can get a list of Boost components from Libtorrent
dependencies and make qBittorrent depend only on these libraries in
turn. For Windows user may provide a custom list via
LibtorrentRasterbar_CUSTOM_BOOST_DEPENDENCIES variable or use generic
list which consists of date_time, system, chrono, random, thread. As a
note: in case of using fully C++11 build, the actual list contains only
boost system library.
Qt resource is innitialized by a static object constructor (see
https://wiki.qt.io/QtResources). When we put resources into a static
library, the linker removes that static objects and thus the resources
themselves. To correct that we append resources to the main executable
sources list. This is done via custom function qbt_target_sources which
knows where to read the executable' name.