aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2009-11-21 23:33:57 +0000
committerAlexander Neundorf <neundorf@kde.org>2009-11-21 23:33:57 +0000
commitb99cd4a967d0460ed8b02f5cf07f56285a28fdd8 (patch)
treec169058af6aca2222c159d52acf44441535295d5
parentb9852ed5d6b124b16854d8415eb1ae0185276f64 (diff)
downloadextra-cmake-modules-b99cd4a967d0460ed8b02f5cf07f56285a28fdd8.tar.gz
extra-cmake-modules-b99cd4a967d0460ed8b02f5cf07f56285a28fdd8.tar.bz2
-improve documentation
-rely less on pkgconfig -honor PolkitQt_FIND_REQUIRED properly -POLKITQT_LIBRARIES doesn't have to be ADVANCED, since it is not in the cache at all -the variable POLKITQT_LIB does not exist Alex svn path=/trunk/KDE/kdelibs/; revision=1052520
-rw-r--r--modules/FindPolkitQt.cmake38
1 files changed, 25 insertions, 13 deletions
diff --git a/modules/FindPolkitQt.cmake b/modules/FindPolkitQt.cmake
index 8f52b10f..922968a3 100644
--- a/modules/FindPolkitQt.cmake
+++ b/modules/FindPolkitQt.cmake
@@ -7,17 +7,22 @@
# POLKITQT_CORE_LIBRARY - Link this to use the polkit-qt-core library only
# POLKITQT_GUI_LIBRARY - Link this to use GUI elements in polkit-qt (polkit-qt-gui)
# POLKITQT_DEFINITIONS - Compiler switches required for using Polkit-qt
+# POLKITQT_POLICY_FILES_INSTALL_DIR - The directory where policy files should be installed to.
+#
+# The minimum required version PolkitQt can be specified by setting the
+# POLKITQT_MIN_VERSION variable.
# Copyright (c) 2009, Daniel Nicoletti, <dantti85-pk@yahoo.com.br>
# Copyright (c) 2009, Dario Freddi, <drf54321@gmail.com>
# Copyright (c) 2009, Michal Malek, <michalm@jabster.pl>
+# Copyright (c) 2009, Alexander Neundorf, <neundorf@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 (POLKITQT_INCLUDE_DIR AND POLKITQT_LIB)
- set(POLKITQT_FIND_QUIETLY TRUE)
-endif (POLKITQT_INCLUDE_DIR AND POLKITQT_LIB)
+if (POLKITQT_INCLUDE_DIR AND POLKITQT_GUI_LIBRARY AND POLKITQT_CORE_LIBRARY)
+ set(PolkitQt_FIND_QUIETLY TRUE)
+endif (POLKITQT_INCLUDE_DIR AND POLKITQT_GUI_LIBRARY AND POLKITQT_CORE_LIBRARY)
if (NOT POLKITQT_MIN_VERSION)
set(POLKITQT_MIN_VERSION "0.9.0")
@@ -49,22 +54,29 @@ include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set POLKITQT_FOUND to TRUE if
# all listed variables are TRUE
-find_package_handle_standard_args(PolkitQt DEFAULT_MSG POLKITQT_LIBRARIES POLKITQT_INCLUDE_DIR)
+find_package_handle_standard_args(PolkitQt DEFAULT_MSG POLKITQT_INCLUDE_DIR POLKITQT_GUI_LIBRARY POLKITQT_CORE_LIBRARY)
mark_as_advanced(POLKITQT_INCLUDE_DIR POLKITQT_CORE_LIBRARY POLKITQT_GUI_LIBRARY POLKITQT_LIBRARIES)
if (POLKITQT_FOUND)
if (PC_POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION)
- message(STATUS "Found Polkit-Qt release < ${POLKITQT_MIN_VERSION}")
- message(STATUS "You need Polkit-Qt version ${POLKITQT_MIN_VERSION} or newer to compile this component")
+ if(PolkitQt_FIND_REQUIRED)
+ message(FATAL_ERROR "Found Polkit-Qt release ${PC_POLKITQT_VERSION}, but at least ${POLKITQT_MIN_VERSION} is required.")
+ else(PolkitQt_FIND_REQUIRED)
+ message(STATUS "Found Polkit-Qt release ${PC_POLKITQT_VERSION}, but at least ${POLKITQT_MIN_VERSION} is required.")
+ endif(PolkitQt_FIND_REQUIRED)
set(POLKITQT_FOUND FALSE)
- return()
- else (PC_POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION)
- if ( NOT PC_POLKITQT_PREFIX STREQUAL CMAKE_INSTALL_PREFIX )
- message("WARNING: Installation prefix does not match PolicyKit install prefixes. You probably will need to move files installed "
- "in POLICY_FILES_INSTALL_DIR and by dbus_add_activation_system_service to the ${PC_POLKITQT_PREFIX} prefix")
- endif (NOT PC_POLKITQT_PREFIX STREQUAL CMAKE_INSTALL_PREFIX)
endif (PC_POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION)
endif (POLKITQT_FOUND)
-set(POLKITQT_POLICY_FILES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/PolicyKit/policy/)
+
+if(POLKITQT_FOUND)
+ get_filename_component(_POLKITQT_INSTALL_PREFIX "${POLKITQT_CORE_LIBRARY}" PATH)
+ get_filename_component(_POLKITQT_INSTALL_PREFIX "${_POLKITQT_INSTALL_PREFIX}" PATH)
+ if ( NOT _POLKITQT_INSTALL_PREFIX STREQUAL CMAKE_INSTALL_PREFIX )
+ message("WARNING: Installation prefix does not match PolicyKit install prefixes. You probably will need to move files installed "
+ "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")
+ endif (NOT _POLKITQT_INSTALL_PREFIX STREQUAL CMAKE_INSTALL_PREFIX)
+endif(POLKITQT_FOUND)
+
+set(POLKITQT_POLICY_FILES_INSTALL_DIR share/PolicyKit/policy/)