2017-07-23 21:58:00 +03:00
|
|
|
macro(dbus_add_activation_service _sources)
|
2023-10-12 17:26:39 +03:00
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.28.0")
|
|
|
|
pkg_get_variable(_install_dir dbus-1 session_bus_services_dir DEFINE_VARIABLES datadir=${CMAKE_INSTALL_DATADIR})
|
|
|
|
else()
|
2022-11-10 22:36:03 +03:00
|
|
|
pkg_get_variable(_install_dir dbus-1 session_bus_services_dir)
|
2023-10-12 17:26:39 +03:00
|
|
|
endif()
|
2017-07-23 21:58:00 +03:00
|
|
|
foreach (_i ${_sources})
|
|
|
|
get_filename_component(_service_file ${_i} ABSOLUTE)
|
|
|
|
string(REGEX REPLACE "\\.service.*$" ".service" _output_file ${_i})
|
|
|
|
set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file})
|
|
|
|
configure_file(${_service_file} ${_target})
|
|
|
|
install(FILES ${_target} DESTINATION ${_install_dir} RENAME "${LIBCLOUDPROVIDERS_DBUS_BUS_NAME}.service")
|
|
|
|
endforeach (_i ${ARGN})
|
|
|
|
endmacro(dbus_add_activation_service _sources)
|
|
|
|
|
|
|
|
macro(libcloudproviders_add_config _sources)
|
|
|
|
set(_install_dir "${CMAKE_INSTALL_PREFIX}/share/cloud-providers")
|
|
|
|
foreach (_i ${_sources})
|
|
|
|
get_filename_component(_service_file ${_i} ABSOLUTE)
|
|
|
|
string(REGEX REPLACE "\\.ini.*$" ".ini" _output_file ${_i})
|
|
|
|
set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file})
|
|
|
|
configure_file(${_service_file} ${_target})
|
|
|
|
install(FILES ${_target} DESTINATION ${_install_dir} RENAME "${LIBCLOUDPROVIDERS_DBUS_BUS_NAME}.ini")
|
|
|
|
endforeach (_i ${ARGN})
|
|
|
|
endmacro(libcloudproviders_add_config _sources)
|
|
|
|
|
|
|
|
|
2021-08-13 12:33:50 +03:00
|
|
|
find_package(Qt5 5.15 COMPONENTS DBus)
|
2021-04-12 18:25:42 +03:00
|
|
|
IF (Qt5DBus_FOUND)
|
2017-07-23 21:58:00 +03:00
|
|
|
STRING(TOLOWER "${APPLICATION_VENDOR}" DBUS_VENDOR)
|
|
|
|
STRING(REGEX REPLACE "[^A-z0-9]" "" DBUS_VENDOR "${DBUS_VENDOR}")
|
|
|
|
STRING(REGEX REPLACE "[^A-z0-9]" "" DBUS_APPLICATION_NAME "${APPLICATION_SHORTNAME}")
|
|
|
|
if (NOT DBUS_PREFIX)
|
|
|
|
set(DBUS_PREFIX "com")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set(LIBCLOUDPROVIDERS_DBUS_BUS_NAME "${DBUS_PREFIX}.${DBUS_VENDOR}.${DBUS_APPLICATION_NAME}")
|
|
|
|
set(LIBCLOUDPROVIDERS_DBUS_OBJECT_PATH "/${DBUS_PREFIX}/${DBUS_VENDOR}/${DBUS_APPLICATION_NAME}")
|
|
|
|
|
|
|
|
dbus_add_activation_service(org.freedesktop.CloudProviders.service.in)
|
2023-12-09 19:11:19 +03:00
|
|
|
# The .ini file has been replaced by a declaration in the .desktop file in 0.3.3+
|
|
|
|
if (${CLOUDPROVIDERS_VERSION} VERSION_LESS "0.3.3")
|
|
|
|
libcloudproviders_add_config(org.freedesktop.CloudProviders.ini.in)
|
|
|
|
endif ()
|
2017-07-23 21:58:00 +03:00
|
|
|
ENDIF ()
|