Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if correct dbus library is found during cmake phase not #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@ else()
pkg_check_modules(DBus REQUIRED dbus-1>=1.4)
endif()

##############################################################################
# Check for correct dbus version (with patches)

try_compile(DBUS_WITH_PATCHES ${CMAKE_BINARY_DIR}/cmake_checks
SOURCES ${CMAKE_SOURCE_DIR}/cmake/check_dbus_connection_send_with_reply_and_block.cpp
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${DBus_INCLUDE_DIRS}"
CMAKE_FLAGS "-DLINK_DIRECTORIES=${DBus_LIBRARY_DIRS}"
LINK_LIBRARIES ${DBus_LIBRARIES}
OUTPUT_VARIABLE dbus_out
)

if(NOT ${DBUS_WITH_PATCHES})
message(FATAL_ERROR "DBus library: ${DBus_LIBRARY_DIRS}/${DBus_LIBRARIES} is not patched")
endif()

##############################################################################

# CommonAPI-DBus build section
Expand Down
8 changes: 8 additions & 0 deletions cmake/check_dbus_connection_send_with_reply_and_block.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

#include <dbus/dbus.h>

int main(void) {
auto z = dbus_connection_send_with_reply_set_notify(nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, 0);
return 0;
}