Completely rework the dependency handling in the build system
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 23 Mar 2014 01:39:38 +0000 (02:39 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 23 Mar 2014 18:41:40 +0000 (19:41 +0100)
commit2273a95ba9c277ce6dd7a67158a3d3ed9f161182
treedbd9ee1f8a3956929a35b303635f6affdddc8b6d
parent60013b8987abc643a31fecf185d463973e009915
Completely rework the dependency handling in the build system

Traditionally, optional build dependencies are handled in CMake via
offering options and conditionally searching for the needed packages.
This leads to having lots of options, boilerplate for telling the user
which features are enabled or not, unclear handling of automagic
dependencies, and so on.

These days, CMake offers a much nicer way: feature_summary() and friends.
To make use of this, one calls find_package unconditionally and then sets
properties on the package that tell CMake if the dependency is optional
or required, its purpose, a description of the package etc. At the end
of configuration, CMake then displays a nice summary of all the packages
searched for and (not) found, as well as other features.

Quassel now makes use of this modern way of specifying dependencies, replacing
most of the former options (they're still there, but unused now, and will
be removed soon). Note that one can still disable an optional dependency Foo by
passing -DCMAKE_DISABLE_FIND_PACKAGE_Foo=TRUE to CMake.

I also took the opportunity to radically clean up and fix how we handle
dependencies throughout the build system:

* We no longer set an extra CMake variable to indicate that a package was
  found, but use the Foo_FOUND variable directly
* Compile definitions and include directories are no longer set globally
  in the root CMakeLists.txt, but in the Quassel modules where they're
  actually needed; this should speed up compiling ever so slightly and
  generally make things much cleaner
* Libraries are now linked directly to the Quassel modules that use them,
  rather than to the executable. This prepares us for making the modules
  shared libraries at some point, and is anyway The Right Thing™ to do
* Fully support Qt5 in the build system, including finding the proper version
  of dependencies where appropriate and available

Note that the changes to the build system are not complete yet, and some things
may be broken now. Note also that while Qt5 is now supported in the build system,
the code itself still requires many changes to actually compile with Qt5,
so don't even try.
CMakeLists.txt
src/CMakeLists.txt
src/client/CMakeLists.txt
src/common/CMakeLists.txt
src/core/CMakeLists.txt
src/qtui/CMakeLists.txt
src/qtui/settingspages/settingspages.cmake
src/uisupport/CMakeLists.txt