Commit 6e432ed5 authored by Clemens Lang's avatar Clemens Lang Committed by Simon McVittie

cmake: Avoid overwriting PKG_CONFIG_PATH env var

The CMake config file installed by DBus will run in the context of other
projects. Consequently, changing the value of the PKG_CONFIG_DIR,
PKG_CONFIG_PATH or PKG_CONFIG_LIBDIR environment variables will affect
any further calls to pkg-config made by such projects, which can cause

A common case of this happening are pkg-config files installed in
usr/share/pkgconfig for .pc files that are architecture-independent, as
for example systemd does.

Avoid clobbering the environment variables by saving and restoring their
values. Note that for some of the variables, setting them to an empty
string is different from not setting them at all.
Signed-off-by: 's avatarClemens Lang <>
(cherry picked from commit 3525cc04)
Closes: #267
parent 7642acca
Pipeline #36452 passed with stage
in 11 minutes and 18 seconds