Skip to content

Install headers with C++ namespace prefix, to avoid lookup conflicts

So far headers for the libraries AknoadiCore, AkonadiWidgtets, AkonadiXml, and AkonadiAgents were installed directly into the directory given as include base dir, as e.g. noted in the link interface. Due to generic names of the headers, without the project prefix, e.g.

#include <item.h>
#include <job.h>

could run chance to instead match other headers from the include directories of other projects.

Given the practice to uee the C++ namespace as path prefix in the include dirs, this patch changes the installation to install the normal headers into an akonadi/ and the CamelCase headers into a Akonadi/ subdir of the respective base include dir, so projects linking to Akonadi libraries can then use

#include <akonadi/item.h>

or

#include <Akonadi/Item>

with less chance to have the wrong headers picked.

To make the headers from AkonadiAgents, AkonadiWidgets and AkonadiXml properly work also when being used from their installed location, they need to be adapted to also use the proper <akonadi/foo.h> includes for the headers from AkonadiCore. ecm_generate_headers() helps with that to work also in the own build by adding matching forwarding headers in the build dir.

To keep projects linking to Akonadi libraries building for now, additionally compat headers are installed to the old locations, emitting compiler warnings hinting the new desired include paths to be used.

I would hope we could fix all current PIM projects in the next weeks to use the prefixed includes, and then remove the compat headers again before 21.12 gets branched. I would help with that.

So far my local build of my set of PIM master repos managed to build, the only failure so far, pointing out the usage of headers of a library not linked to, as kmail!40 (merged)

@mlaurent @vkrause

Merge request reports

Loading