~ubuntu-branches/ubuntu/oneiric/polkit-qt-1/oneiric

« back to all changes in this revision

Viewing changes to cmake/modules/FindPolkitQt-1.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2010-12-09 08:31:42 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20101209083142-afdb8t0gs3lgca3f
Tags: 0.99.0-0ubuntu1
* New upstream release:
  - Update libpolkit-qt-1-dev.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
#  POLKITQT-1_GUI_LIBRARY - Link this to use GUI elements in polkit-qt (polkit-qt-gui)
9
9
#  POLKITQT-1_AGENT_LIBRARY - Link this to use the agent wrapper in polkit-qt
10
10
#  POLKITQT-1_DEFINITIONS - Compiler switches required for using Polkit-qt
 
11
#
 
12
# The minimum required version of PolkitQt-1 can be specified using the
 
13
# standard syntax, e.g. find_package(PolkitQt-1 1.0)
11
14
 
12
 
# Copyright (c) 2009, Dario Freddi, <drf@kde.org>
 
15
# Copyright (c) 2010, Dario Freddi, <drf@kde.org>
13
16
#
14
17
# Redistribution and use is allowed according to the terms of the BSD license.
15
18
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
16
19
 
17
 
if (POLKITQT-1_INCLUDE_DIR AND POLKITQT-1_LIB)
18
 
    set(POLKITQT-1_FIND_QUIETLY TRUE)
19
 
endif (POLKITQT-1_INCLUDE_DIR AND POLKITQT-1_LIB)
20
 
 
21
 
if (NOT POLKITQT-1_MIN_VERSION)
22
 
  set(POLKITQT-1_MIN_VERSION "0.95.1")
23
 
endif (NOT POLKITQT-1_MIN_VERSION)
24
 
 
25
 
if (NOT WIN32)
26
 
   # use pkg-config to get the directories and then use these values
27
 
   # in the FIND_PATH() and FIND_LIBRARY() calls
28
 
   find_package(PkgConfig)
29
 
   pkg_check_modules(PC_POLKITQT-1 QUIET polkit-qt-1)
30
 
   set(POLKITQT-1_DEFINITIONS ${PC_POLKITQT-1_CFLAGS_OTHER})
31
 
endif (NOT WIN32)
32
 
 
33
 
find_path( POLKITQT-1_INCLUDE_DIR
34
 
     NAMES polkitqt1-authority.h
35
 
     PATH_SUFFIXES polkit-qt-1
36
 
)
37
 
 
38
 
find_path( POLKITQT-1_VERSION_FILE
39
 
     NAMES polkitqt1-version.h
40
 
     PATH_SUFFIXES polkit-qt-1
41
 
)
42
 
 
43
 
set(POLKITQT-1_VERSION_OK TRUE)
44
 
if(POLKITQT-1_VERSION_FILE)
45
 
  file(READ ${POLKITQT-1_INCLUDE_DIR}/polkitqt1-version.h POLKITQT-1_VERSION_CONTENT)
46
 
  string (REGEX MATCH "POLKITQT1_VERSION_STRING \".*\"\n" POLKITQT-1_VERSION_MATCH "${POLKITQT-1_VERSION_CONTENT}")
47
 
  
48
 
  if(POLKITQT-1_VERSION_MATCH)
49
 
    string(REGEX REPLACE "POLKITQT1_VERSION_STRING \"(.*)\"\n" "\\1" POLKITQT-1_VERSION ${POLKITQT-1_VERSION_MATCH})
50
 
    if(POLKITQT-1_VERSION STRLESS "${POLKITQT-1_MIN_VERSION}")
51
 
      set(POLKITQT-1_VERSION_OK FALSE)
52
 
      if(PolkitQt-1_FIND_REQUIRED)
53
 
        message(FATAL_ERROR "PolkitQt-1 version ${POLKITQT-1_VERSION} was found, but it is too old. Please install ${POLKITQT-1_MIN_VERSION} or newer.")
54
 
      else(PolkitQt-1_FIND_REQUIRED)
55
 
        message(STATUS "PolkitQt-1 version ${POLKITQT-1_VERSION} is too old. Please install ${POLKITQT-1_MIN_VERSION} or newer.")
56
 
      endif(PolkitQt-1_FIND_REQUIRED)
57
 
    endif(POLKITQT-1_VERSION STRLESS "${POLKITQT-1_MIN_VERSION}")
58
 
  endif(POLKITQT-1_VERSION_MATCH)
59
 
elseif(POLKITQT-1_INCLUDE_DIR)
60
 
  # The version is so old that it does not even have the file
61
 
  set(POLKITQT-1_VERSION_OK FALSE)
62
 
  if(PolkitQt_FIND_REQUIRED)
63
 
    message(FATAL_ERROR "It looks like PolkitQt-1 is too old. Please install PolkitQt-1 version ${POLKITQT-1_MIN_VERSION} or newer.")
64
 
  else(PolkitQt_FIND_REQUIRED)
65
 
    message(STATUS "It looks like PolkitQt-1 is too old. Please install PolkitQt-1 version ${POLKITQT-1_MIN_VERSION} or newer.")
66
 
  endif(PolkitQt_FIND_REQUIRED)
67
 
endif(POLKITQT-1_VERSION_FILE)
68
 
 
69
 
find_library( POLKITQT-1_CORE_LIBRARY 
70
 
    NAMES polkit-qt-core-1
71
 
    HINTS ${PC_POLKITQT-1_LIBDIR}
72
 
)
73
 
find_library( POLKITQT-1_GUI_LIBRARY 
74
 
    NAMES polkit-qt-gui-1
75
 
    HINTS ${PC_POLKITQT-1_LIBDIR}
76
 
)
77
 
find_library( POLKITQT-1_AGENT_LIBRARY 
78
 
    NAMES polkit-qt-agent-1
79
 
    HINTS ${PC_POLKITQT-1_LIBDIR}
80
 
)
81
 
 
82
 
set(POLKITQT-1_LIBRARIES ${POLKITQT-1_GUI_LIBRARY} ${POLKITQT-1_CORE_LIBRARY} ${POLKITQT-1_AGENT_LIBRARY})
83
 
 
84
 
include(FindPackageHandleStandardArgs)
85
 
 
86
 
# handle the QUIETLY and REQUIRED arguments and set POLKITQT-1_FOUND to TRUE if 
87
 
# all listed variables are TRUE
88
 
find_package_handle_standard_args(PolkitQt-1 DEFAULT_MSG POLKITQT-1_LIBRARIES POLKITQT-1_INCLUDE_DIR POLKITQT-1_VERSION_OK)
89
 
 
90
 
mark_as_advanced(POLKITQT-1_INCLUDE_DIR POLKITQT-1_CORE_LIBRARY POLKITQT-1_GUI_LIBRARY POLKITQT-1_LIBRARIES POLKITQT-1_VERSION_OK)
 
20
# Support POLKITQT-1_MIN_VERSION for compatibility:
 
21
if ( NOT PolkitQt-1_FIND_VERSION AND POLKITQT-1_MIN_VERSION )
 
22
  set ( PolkitQt-1_FIND_VERSION ${POLKITQT-1_MIN_VERSION} )
 
23
endif ( NOT PolkitQt-1_FIND_VERSION AND POLKITQT-1_MIN_VERSION )
 
24
 
 
25
set( _PolkitQt-1_FIND_QUIETLY  ${PolkitQt-1_FIND_QUIETLY} )
 
26
find_package( PolkitQt-1 ${PolkitQt-1_FIND_VERSION} QUIET NO_MODULE PATHS ${LIB_INSTALL_DIR}/PolkitQt-1/cmake )
 
27
set( PolkitQt-1_FIND_QUIETLY ${_PolkitQt-1_FIND_QUIETLY} )
 
28
 
 
29
include( FindPackageHandleStandardArgs )
 
30
find_package_handle_standard_args( PolkitQt-1 DEFAULT_MSG PolkitQt-1_CONFIG )
91
31
 
92
32
if (POLKITQT-1_FOUND)
93
 
    if (NOT PC_POLKITQT-1_PREFIX STREQUAL CMAKE_INSTALL_PREFIX)
 
33
    if (NOT POLKITQT-1_INSTALL_DIR STREQUAL CMAKE_INSTALL_PREFIX)
94
34
        message("WARNING: Installation prefix does not match PolicyKit install prefixes. You probably will need to move files installed "
95
 
                "in POLICY_FILES_INSTALL_DIR and by dbus_add_activation_system_service to the ${PC_POLKITQT-1_PREFIX} prefix")
96
 
    endif (NOT PC_POLKITQT-1_PREFIX STREQUAL CMAKE_INSTALL_PREFIX)
 
35
                "in POLICY_FILES_INSTALL_DIR and by dbus_add_activation_system_service to the ${POLKITQT-1_INSTALL_DIR} prefix")
 
36
    endif (NOT POLKITQT-1_INSTALL_DIR STREQUAL CMAKE_INSTALL_PREFIX)
97
37
endif (POLKITQT-1_FOUND)
98
 
 
99
 
set(POLKITQT-1_POLICY_FILES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/polkit-1/actions)