cmake: Move sdbus-c++ check to one place
Also set SDBUS_CPP_VERSION_2 macro in case sdbus-c++ was found in version 2. This enables conditional compilation according the version of the library found.
This commit is contained in:
parent
32cdedd5cf
commit
1e1a0627a5
|
@ -0,0 +1,10 @@
|
|||
# Attempt to find sdbus-c++ version 2 (preferred)
|
||||
pkg_check_modules(SDBUS_CPP REQUIRED sdbus-c++>=1)
|
||||
|
||||
if(SDBUS_CPP_VERSION LESS 2)
|
||||
message(STATUS "Using sdbus-c++ version 1")
|
||||
else()
|
||||
# Define macro for version 2 if found
|
||||
add_definitions(-DSDBUS_CPP_VERSION_2)
|
||||
message(STATUS "Using sdbus-c++ version 2")
|
||||
endif()
|
|
@ -7,7 +7,7 @@ add_library(needs_restarting_cmd_plugin MODULE needs_restarting.cpp needs_restar
|
|||
# disable the 'lib' prefix in order to create needs_restarting_cmd_plugin.so
|
||||
set_target_properties(needs_restarting_cmd_plugin PROPERTIES PREFIX "")
|
||||
|
||||
pkg_check_modules(SDBUS_CPP REQUIRED sdbus-c++)
|
||||
include(sdbus_cpp)
|
||||
|
||||
target_link_libraries(needs_restarting_cmd_plugin PRIVATE dnf5 libdnf5 libdnf5-cli ${SDBUS_CPP_LIBRARIES})
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ install(TARGETS dnf5 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|||
pkg_check_modules(RPM REQUIRED rpm>=4.17.0)
|
||||
|
||||
if(WITH_SYSTEMD)
|
||||
pkg_check_modules(SDBUS_CPP REQUIRED sdbus-c++)
|
||||
include(sdbus_cpp)
|
||||
pkg_check_modules(LIBSYSTEMD REQUIRED libsystemd)
|
||||
add_definitions(-DWITH_SYSTEMD)
|
||||
target_link_libraries(dnf5 PRIVATE ${RPM_LIBRARIES} ${SDBUS_CPP_LIBRARIES} ${LIBSYSTEMD_LIBRARIES})
|
||||
|
|
|
@ -13,8 +13,7 @@ include_directories(.)
|
|||
# TODO(mblaha) workaround for dnf5daemon-client using server's headers, fix
|
||||
include_directories(..)
|
||||
|
||||
pkg_check_modules(SDBUS_CPP REQUIRED sdbus-c++>=0.9.0)
|
||||
|
||||
include(sdbus_cpp)
|
||||
pkg_check_modules(JSONC REQUIRED json-c)
|
||||
include_directories(${JSONC_INCLUDE_DIRS})
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ add_definitions(-DGETTEXT_DOMAIN=\"${GETTEXT_DOMAIN}\")
|
|||
include_directories(.)
|
||||
|
||||
pkg_check_modules(JSONC REQUIRED json-c)
|
||||
pkg_check_modules(SDBUS_CPP REQUIRED sdbus-c++>=0.9.0)
|
||||
include(sdbus_cpp)
|
||||
find_package(Threads)
|
||||
|
||||
include_directories(${JSONC_INCLUDE_DIRS})
|
||||
|
|
Loading…
Reference in New Issue