summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindPolkit.cmake
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-10-30 12:06:43 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-10-30 12:06:43 +0900
commit28de2ff84f59ac0b173670aa9c5331bc77c1e63f (patch)
tree43dcf0f461ee5552100b648e38979982c971597d /cmake/modules/FindPolkit.cmake
downloadpolkit-tqt-28de2ff84f59ac0b173670aa9c5331bc77c1e63f.tar.gz
polkit-tqt-28de2ff84f59ac0b173670aa9c5331bc77c1e63f.zip
Initial import from polkit-qt-1 debian snapshot archive.
https://snapshot.debian.org/package/polkit-qt-1/0.103.0-1/ Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'cmake/modules/FindPolkit.cmake')
-rw-r--r--cmake/modules/FindPolkit.cmake75
1 files changed, 75 insertions, 0 deletions
diff --git a/cmake/modules/FindPolkit.cmake b/cmake/modules/FindPolkit.cmake
new file mode 100644
index 000000000..35fc86e15
--- /dev/null
+++ b/cmake/modules/FindPolkit.cmake
@@ -0,0 +1,75 @@
+# - Try to find Polkit
+# Once done this will define
+#
+# POLKIT_FOUND - system has Polkit
+# POLKIT_INCLUDE_DIRS - Polkit's include directories
+# POLKIT_AGENT_INCLUDE_DIRS - Polkit-agent's include directories
+# POLKIT_LIBRARIES - Link this to use polkit's gobject library
+# POLKIT_AGENT_LIBRARY - Link this to use the agent wrapper in polkit
+# POLKIT_DEFINITIONS - Compiler switches required for using Polkit
+
+# Copyright (c) 2009, Dario Freddi, <drf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+if (POLKIT_INCLUDE_DIR AND POLKIT_LIB)
+ set(POLKIT_FIND_QUIETLY TRUE)
+endif (POLKIT_INCLUDE_DIR AND POLKIT_LIB)
+
+if (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ find_package(PkgConfig)
+ pkg_check_modules(PC_POLKIT polkit-gobject-1)
+ pkg_check_modules(PC_POLKIT_AGENT polkit-agent-1)
+ set(POLKIT_DEFINITIONS ${PC_POLKIT_CFLAGS_OTHER})
+endif (NOT WIN32)
+
+# We must include glib paths too... which sucks balls
+find_package(GLIB2)
+
+find_path( GLIB_CONFIG_INCLUDE_DIR
+ NAMES glibconfig.h
+ PATH_SUFFIXES glib-2.0/include
+ HINTS ${PC_POLKIT_INCLUDE_DIRS}
+)
+
+find_path( POLKIT_INCLUDE_DIR
+ NAMES polkit/polkit.h
+ PATH_SUFFIXES polkit-1
+ HINTS ${PC_POLKIT_INCLUDE_DIRS}
+)
+
+find_path( POLKIT_AGENT_INCLUDE_DIR
+ NAMES polkitagent/polkitagent.h
+ PATH_SUFFIXES polkit-1
+ HINTS ${PC_POLKIT_AGENT_INCLUDE_DIRS}
+)
+
+#set(POLKIT_INCLUDE_DIRS ${GLIB2_INCLUDE_DIR} ${_POLKIT_INCLUDE_DIR})
+#set(POLKIT_AGENT_INCLUDE_DIRS ${GLIB2_INCLUDE_DIR} ${_POLKIT_AGENT_INCLUDE_DIR})
+
+find_library( POLKIT_LIBRARIES
+ NAMES polkit-gobject-1
+ HINTS ${PC_POLKIT_LIBDIR}
+)
+
+find_library( POLKIT_AGENT_LIBRARY
+ NAMES polkit-agent-1
+ HINTS ${PC_POLKIT_AGENT_LIBDIR}
+)
+
+#set(POLKIT_LIBRARIES ${_POLKIT_LIBRARIES} ${GLIB2_LIBRARIES})
+#set(POLKIT_AGENT_LIBRARY ${_POLKIT_AGENT_LIBRARY} ${GLIB2_LIBRARIES})
+
+include(FindPackageHandleStandardArgs)
+
+# handle the QUIETLY and REQUIRED arguments and set POLKIT_FOUND to TRUE if
+# all listed variables are TRUE
+find_package_handle_standard_args(Polkit DEFAULT_MSG POLKIT_LIBRARIES POLKIT_AGENT_LIBRARY
+ POLKIT_INCLUDE_DIR POLKIT_AGENT_INCLUDE_DIR GLIB2_FOUND)
+
+mark_as_advanced(POLKIT_INCLUDE_DIRS POLKIT_AGENT_INCLUDE_DIRS POLKIT_LIBRARIES POLKIT_AGENT_LIBRARY GLIB_INCLUDE_DIR)
+
+set(POLKIT_POLICY_FILES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/polkit-1/actions)