summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/TDEMacros.cmake45
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 1b21c23..338625d 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -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