mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-20 04:30:10 +01:00
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>
This commit is contained in:
parent
6238a9818d
commit
104df89947
1 changed files with 4 additions and 0 deletions
|
|
@ -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}")
|
||||
|
|
@ -50,6 +51,9 @@ set(DBus1_DEFINITIONS ${PC_DBUS1_CFLAGS_OTHER})
|
|||
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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue