Skip to content

Allow additional include directories in the pkgconfig function

Some KF libraries (such as kconfig) require additional include directories in the cflags. While it was possible to add these with DEFINES it wasn't ergonomic and had different behavior than the include added by INCLUDE_INSTALL_DIR (which automatically handled absolute paths).

Add a new variable ADDITIONAL_INCLUDE_DIRS which is processed the same as INCLUDE_INSTALL_DIR with respect to being added to the cflags.

That causes the following example:

ecm_generate_pkgconfig_file(BASE_NAME KF6ConfigCore
    INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF}/KConfigCore
    ADDITIONAL_INCLUDE_DIRS ${KDE_INSTALL_INCLUDEDIR_KF}/KConfig /absolute/test
    DEPS Qt6Core
    INSTALL
)

To result in the following output:

...
includedir=${prefix}/include/KF6/KConfigCore
...
Cflags: -I${prefix}/include/KF6/KConfigCore -I${prefix}/include/KF6/KConfig -I/absolute/test
...

This MR also includes a trivial fix for the DEFINES variable not working.

Merge request reports

Loading