Warning, /frameworks/kdelibs4support/cmake/modules/FindPolkitQt.cmake is written in an unsupported language. File is not indexed.

0001 # - Try to find Polkit-qt
0002 # Once done this will define
0003 #
0004 #  POLKITQT_FOUND - system has Polkit-qt
0005 #  POLKITQT_INCLUDE_DIR - the Polkit-qt include directory
0006 #  POLKITQT_LIBRARIES - Link these to use all Polkit-qt libs
0007 #  POLKITQT_CORE_LIBRARY - Link this to use the polkit-qt-core library only
0008 #  POLKITQT_GUI_LIBRARY - Link this to use GUI elements in polkit-qt (polkit-qt-gui)
0009 #  POLKITQT_DEFINITIONS - Compiler switches required for using Polkit-qt
0010 #  POLKITQT_POLICY_FILES_INSTALL_DIR - The directory where policy files should be installed to.
0011 #
0012 # The minimum required version of PolkitQt can be specified using the
0013 # standard syntax, e.g. find_package(PolkitQt 1.0)
0014 # For compatibility, this can also be done by setting the POLKITQT_MIN_VERSION variable.
0015 
0016 # Copyright (c) 2009, Daniel Nicoletti, <dantti85-pk@yahoo.com.br>
0017 # Copyright (c) 2009, Dario Freddi, <drf54321@gmail.com>
0018 # Copyright (c) 2009, Michal Malek, <michalm@jabster.pl>
0019 # Copyright (c) 2009, Alexander Neundorf, <neundorf@kde.org>
0020 #
0021 # Redistribution and use is allowed according to the terms of the BSD license.
0022 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0023 
0024 
0025 # Support POLKITQT_MIN_VERSION for compatibility:
0026 if(NOT PolkitQt_FIND_VERSION)
0027   set(PolkitQt_FIND_VERSION "${POLKITQT_MIN_VERSION}")
0028 endif(NOT PolkitQt_FIND_VERSION)
0029 
0030 # the minimum version of PolkitQt we require
0031 if(NOT PolkitQt_FIND_VERSION)
0032   set(PolkitQt_FIND_VERSION "0.9.3")
0033 endif(NOT PolkitQt_FIND_VERSION)
0034 
0035 if (NOT WIN32)
0036    # use pkg-config to get the directories and then use these values
0037    # in the FIND_PATH() and FIND_LIBRARY() calls
0038    find_package(PkgConfig)
0039    pkg_check_modules(PC_POLKITQT QUIET polkit-qt)
0040    set(POLKITQT_DEFINITIONS ${PC_POLKITQT_CFLAGS_OTHER})
0041 endif (NOT WIN32)
0042 
0043 find_path( POLKITQT_INCLUDE_DIR
0044      NAMES polkit-qt/auth.h
0045      PATH_SUFFIXES PolicyKit
0046 )
0047 
0048 find_file( POLKITQT_VERSION_FILE
0049      polkit-qt/polkitqtversion.h
0050      HINTS ${POLKITQT_INCLUDE_DIR}
0051 )
0052 
0053 if(POLKITQT_VERSION_FILE  AND NOT  POLKITQT_VERSION)
0054   file(READ ${POLKITQT_VERSION_FILE} POLKITQT_VERSION_CONTENT)
0055   string (REGEX MATCH "POLKITQT_VERSION_STRING \".*\"\n" POLKITQT_VERSION_MATCH "${POLKITQT_VERSION_CONTENT}")
0056 
0057   if(POLKITQT_VERSION_MATCH)
0058     string(REGEX REPLACE "POLKITQT_VERSION_STRING \"(.*)\"\n" "\\1" _POLKITQT_VERSION ${POLKITQT_VERSION_MATCH})
0059   endif(POLKITQT_VERSION_MATCH)
0060   set(POLKITQT_VERSION "${_POLKITQT_VERSION}" CACHE STRING "Version number of PolkitQt" FORCE)
0061 endif(POLKITQT_VERSION_FILE  AND NOT  POLKITQT_VERSION)
0062 
0063 find_library( POLKITQT_CORE_LIBRARY
0064     NAMES polkit-qt-core
0065     HINTS ${PC_POLKITQT_LIBDIR}
0066 )
0067 find_library( POLKITQT_GUI_LIBRARY
0068     NAMES polkit-qt-gui
0069     HINTS ${PC_POLKITQT_LIBDIR}
0070 )
0071 set(POLKITQT_LIBRARIES ${POLKITQT_GUI_LIBRARY} ${POLKITQT_CORE_LIBRARY})
0072 
0073 include(FindPackageHandleStandardArgs)
0074 # Use the extended (new) syntax for FPHSA():
0075 find_package_handle_standard_args(PolkitQt  REQUIRED_VARS POLKITQT_GUI_LIBRARY POLKITQT_CORE_LIBRARY POLKITQT_INCLUDE_DIR
0076                                             VERSION_VAR  POLKITQT_VERSION)
0077 
0078 mark_as_advanced(POLKITQT_INCLUDE_DIR
0079                  POLKITQT_CORE_LIBRARY
0080                  POLKITQT_GUI_LIBRARY
0081                  POLKITQT_VERSION_FILE
0082                 )
0083 
0084 set(POLKITQT_POLICY_FILES_INSTALL_DIR share/PolicyKit/policy/)
0085 
0086 if(POLKITQT_FOUND)
0087     get_filename_component(_POLKITQT_INSTALL_PREFIX "${POLKITQT_CORE_LIBRARY}"  PATH)
0088     get_filename_component(_POLKITQT_INSTALL_PREFIX "${_POLKITQT_INSTALL_PREFIX}"  PATH)
0089     if ( NOT _POLKITQT_INSTALL_PREFIX STREQUAL CMAKE_INSTALL_PREFIX )
0090         message("WARNING: Installation prefix does not match PolicyKit install prefixes. You probably will need to move files installed "
0091                 "in ${CMAKE_INSTALL_PREFIX}/${POLKITQT_POLICY_FILES_INSTALL_DIR} and by dbus_add_activation_system_service to the ${_POLKITQT_INSTALL_PREFIX}/${POLKITQT_POLICY_FILES_INSTALL_DIR} prefix")
0092     endif (NOT _POLKITQT_INSTALL_PREFIX STREQUAL CMAKE_INSTALL_PREFIX)
0093 endif(POLKITQT_FOUND)
0094