mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-03-25 15:20:38 +01:00
cmake: Detect backtrace() support on platforms such as FreeBSD
On FreeBSD use of backtrace requires linking libexecinfo. The current check_symbol_exists() will fail due to that missing library. Fortunately, CMake ships with a FindBacktrace module (at least since 3.0) that can be used to correctly handle platforms such as FreeBSD (and OpenBSD according to the FindBacktrace source).
This commit is contained in:
parent
1312fd5f81
commit
3f5bdf0c2d
2 changed files with 7 additions and 1 deletions
|
|
@ -42,7 +42,9 @@ check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H)# dbus-sysdeps-win.c
|
|||
check_include_file(unistd.h HAVE_UNISTD_H) # dbus-sysdeps-util-win.c
|
||||
check_include_file(sys/inotify.h DBUS_BUS_ENABLE_INOTIFY)
|
||||
|
||||
check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE) # dbus-sysdeps.c, dbus-sysdeps-win.c
|
||||
find_package(Backtrace) # dbus-sysdeps.c, dbus-sysdeps-win.c
|
||||
set(HAVE_BACKTRACE ${Backtrace_FOUND})
|
||||
|
||||
check_symbol_exists(getgrouplist "grp.h" HAVE_GETGROUPLIST) # dbus-sysdeps.c
|
||||
check_symbol_exists(getpeerucred "ucred.h" HAVE_GETPEERUCRED) # dbus-sysdeps.c, dbus-sysdeps-win.c
|
||||
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP) # dbus-sysdeps.c
|
||||
|
|
|
|||
|
|
@ -292,6 +292,10 @@ else(WIN32)
|
|||
if(LIBSOCKET)
|
||||
target_link_libraries(dbus-1 ${LIBSOCKET})
|
||||
endif()
|
||||
if (HAVE_BACKTRACE)
|
||||
target_link_libraries(dbus-1 ${Backtrace_LIBRARY})
|
||||
target_include_directories(dbus-1 PRIVATE ${Backtrace_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_include_directories(dbus-1 INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/dbus-1.0>;$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}/dbus-1.0/include>)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue