diff options
author | Simon McVittie <smcv@collabora.com> | 2020-11-06 14:42:19 +0000 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2022-03-30 07:36:38 +0000 |
commit | 104df89947913e97bf4253d7dea53626063f6406 (patch) | |
tree | b3618b8b06da7865aea37737d0f87054a848bc4b /cmake | |
parent | 6238a9818d97f3ba2da30bc7953e79de56404642 (diff) | |
download | dbus-104df89947913e97bf4253d7dea53626063f6406.tar.gz |
cmake: Look for dbus-arch-deps.h next to DBus1Config.cmake
<dbus/dbus-arch-deps.h> is architecture-dependent, and compilers have
not traditionally supported an installation path for architecture-specific
headers (Debian-based systems have /usr/include/${multiarch_tuple}, but
that isn't portable beyond Debian). When dbus was built using Autotools,
dependent projects that use CMake need to look for this header in the
right place.
Unfortunately, it seems that at least recent versions of CMake will
ignore the HINTS we get from pkg-config if they are told to search in
a non-standard prefix via ${DBus1_ROOT}.
Look for dbus-arch-deps.h in a directory derived from the filename of
the CMake config file, before trying the normal search algorithm. The
CMake config file is in ${libdir}, and so is the architecture-specific
header, so this should work reasonably reliably.
According to the CMake documentation, if we search for the same thing
multiple times, the first successful result will be used; and searching
with NO_DEFAULT_PATH is the official way to prepend things to the
search order.
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/314
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/DBus1Config.pkgconfig.in | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cmake/DBus1Config.pkgconfig.in b/cmake/DBus1Config.pkgconfig.in index 93c593e1..0f021850 100644 --- a/cmake/DBus1Config.pkgconfig.in +++ b/cmake/DBus1Config.pkgconfig.in @@ -9,6 +9,7 @@ # to a target with target_link_libraries get_filename_component(DBus1_PKGCONFIG_DIR "${CMAKE_CURRENT_LIST_DIR}/../../pkgconfig" ABSOLUTE) +get_filename_component(DBus1_NEARBY_ARCH_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../dbus-1.0/include" ABSOLUTE) find_package(PkgConfig) if(DEFINED ENV{PKG_CONFIG_DIR}) set(_dbus_pkgconfig_dir "$ENV{PKG_CONFIG_DIR}") @@ -51,6 +52,9 @@ find_path(DBus1_INCLUDE_DIR dbus/dbus.h HINTS ${PC_DBUS1_INCLUDEDIR} ${PC_DBUS1_INCLUDE_DIRS} PATH_SUFFIXES dbus-1.0) find_path(DBus1_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h + PATHS ${DBus1_NEARBY_ARCH_INCLUDE_DIR} + NO_DEFAULT_PATH) +find_path(DBus1_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h HINTS ${PC_DBUS1_INCLUDE_DIRS} PATH_SUFFIXES dbus-1.0) find_library(DBus1_LIBRARY NAMES ${PC_DBUS1_LIBRARIES} |