Browse Source

Add tde_setup_polkit macro.

This resolves issue #21.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/23/head
Slávek Banko 1 year ago
parent
commit
a2fbe3aa43
No known key found for this signature in database GPG Key ID: 608F5293A04BE668
1 changed files with 45 additions and 0 deletions
  1. +45
    -0
      modules/TDEMacros.cmake

+ 45
- 0
modules/TDEMacros.cmake View File

@@ -2091,6 +2091,51 @@ macro( tde_setup_dbus )
endmacro( )


#################################################
#####
##### tde_setup_polkit

macro( tde_setup_polkit )
if( NOT POLKIT_GOBJECT_FOUND )
pkg_search_module( POLKIT_GOBJECT polkit-gobject-1 )
if( NOT POLKIT_GOBJECT_FOUND )
tde_message_fatal( "polkit-gobject-1 is required, but not found on your system" )
endif( )
endif( )

foreach( _arg ${ARGV} )
if( NOT "${_arg}" MATCHES "^polkit-" )
set( _arg "polkit-${_arg}" )
endif( )
string( TOUPPER "${_arg}" _polkit_module )
if( "${_polkit_module}" MATCHES "-[0-9]+$" )
string( REGEX REPLACE "-[0-9]+$" "" _polkit_module "${_polkit_module}" )
endif( )
string( REPLACE "-" "_" _polkit_module "${_polkit_module}" )
if( NOT "${_arg}" MATCHES "-[0-9]+$" )
set( _arg "${_arg}-1" )
endif( )
if( NOT ${_polkit_module}_FOUND )
pkg_search_module( ${_polkit_module} ${_arg} )
if( NOT ${_polkit_module}_FOUND )
tde_message_fatal( "${_arg} is required, but not found on your system" )
endif( )
endif( )
endforeach( )

if( NOT DEFINED POLKIT_ACTIONS_DIRECTORY )
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE}
polkit-gobject-1 --variable=actiondir
OUTPUT_VARIABLE POLKIT_ACTIONS_DIRECTORY
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message( STATUS "Using " ${POLKIT_ACTIONS_DIRECTORY} " for PolicyKit action files" )
endif( )

endmacro( )


################################################
#####
##### Restore CMP0026 policy


Loading…
Cancel
Save