~phablet-team/telephony-service/trunk

« back to all changes in this revision

Viewing changes to cmake/modules/FindQtMobility.cmake

  • Committer: Gustavo Pichorim Boiko
  • Date: 2012-06-08 21:50:34 UTC
  • mto: This revision was merged to the branch mainline in revision 147.
  • Revision ID: boiko@canonical.com-20120608215034-eylefciy1lls6rtr
Find the QtMobility contacts module and add it to the linking

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# - Try to find the QtMobility libraries
 
2
#
 
3
# This module will search for the QtMobility libraries.
 
4
#
 
5
# It supports both a minimum version and searching for individual
 
6
# components. For the minimum version, use
 
7
# find_package(QtMobility 1.2.0). For specific components, use
 
8
# find_package(QtMobility COMPONENTS ...). See below for a list of known
 
9
# components.
 
10
#
 
11
# Once done this will define
 
12
#  QTMOBILITY_FOUND - QtMobility and all specified components were found.
 
13
#  QTMOBILITY_INCLUDE_DIR - Include directory for global QtMobility files.
 
14
#  QTMOBILITY_INCLUDE_DIRS - All found QtMobility components' include dirs.
 
15
#  QTMOBILITY_LIBRARIES - All found QtMobility components' libraries.
 
16
#  QTMOBILITY_VERSION - The version of QtMobility that was found.
 
17
#
 
18
# For each found component the following will be defined:
 
19
#  QTMOBILITY_{COMPONENT}_INCLUDE_DIR - The include directory for the component.
 
20
#  QTMOBILITY_{COMPONENT}_LIBRARY - The location of the library for the component.
 
21
#
 
22
# Note that searching for components will be limited to the specified components
 
23
# if the components option is used.
 
24
#
 
25
# Copyright (c) 2011 Arjen Hiemstra <ahiemstra@heimr.nl>
 
26
# Redistribution and use is allowed according to the terms of the BSD license.
 
27
 
 
28
set(QTMOBILITY_COMPONENTS
 
29
    Bearer
 
30
    Connectivity
 
31
    Contacts
 
32
    Feedback
 
33
    Gallery
 
34
    Location
 
35
    Messaging
 
36
    MultimediaKit
 
37
    Organizer
 
38
    PublishSubscribe
 
39
    Sensors
 
40
    ServiceFramework
 
41
    SystemInfo
 
42
    Versit
 
43
)
 
44
 
 
45
if (QtMobility_FIND_COMPONENTS)
 
46
  foreach (component ${QtMobility_FIND_COMPONENTS})
 
47
    string(TOUPPER ${component} _COMPONENT)
 
48
    set(QTMOBILITY_USE_${_COMPONENT} 1)
 
49
  endforeach (component)
 
50
endif (QtMobility_FIND_COMPONENTS)
 
51
 
 
52
find_path(QTMOBILITY_INCLUDE_DIR qmobilityglobal.h PATH_SUFFIXES QtMobility)
 
53
 
 
54
#Find the mobility version
 
55
if(QTMOBILITY_INCLUDE_DIR)
 
56
    file(READ "${QTMOBILITY_INCLUDE_DIR}/qmobilityglobal.h" _qtmobility_global_header LIMIT 5000)
 
57
    string(REGEX MATCH "#define QTM_VERSION_STR +\"([0-9.]*)\"" _qtmobility_version_match  "${_qtmobility_global_header}")
 
58
    set(QTMOBILITY_VERSION "${CMAKE_MATCH_1}")
 
59
endif(QTMOBILITY_INCLUDE_DIR)
 
60
 
 
61
set(QTMOBILITY_VARIABLES "QTMOBILITY_INCLUDE_DIR")
 
62
 
 
63
set(QTMOBILITY_INCLUDE_DIRS ${QTMOBILITY_INCLUDE_DIR})
 
64
 
 
65
#A list of files to find for specific components
 
66
set(QTMOBILITY_FIND_FILES
 
67
    QNetworkConfiguration #Bearer
 
68
    QBluetoothSocket #Connectivity
 
69
    QContact #Contacts
 
70
    QFeedbackInterface #Feedback
 
71
    QAbstractGallery #Gallery
 
72
    QLandmark #Location
 
73
    QMessage #Messaging
 
74
    QMediaPlayer #MultimediaKit
 
75
    QOrganizerItem #Organizer
 
76
    QValueSpace #PublishSubscribe
 
77
    QSensor #Sensors
 
78
    QService #ServiceFramework
 
79
    QSystemInfo #SystemInfo
 
80
    QVersitDocument #Versit
 
81
)
 
82
 
 
83
list(LENGTH QTMOBILITY_COMPONENTS _component_count)
 
84
math(EXPR _component_count "${_component_count} - 1")
 
85
foreach (index RANGE ${_component_count})
 
86
    list(GET QTMOBILITY_COMPONENTS ${index} component)
 
87
    list(GET QTMOBILITY_FIND_FILES ${index} file)
 
88
    string(TOUPPER ${component} _COMPONENT)
 
89
 
 
90
    if (NOT QtMobility_FIND_COMPONENTS OR QTMOBILITY_USE_${_COMPONENT})
 
91
        find_path(QTMOBILITY_${_COMPONENT}_INCLUDE_DIR ${file} PATH_SUFFIXES Qt${component} qt4/Qt${component})
 
92
        find_library(QTMOBILITY_${_COMPONENT}_LIBRARY NAMES Qt${component})
 
93
 
 
94
        list(APPEND QTMOBILITY_VARIABLES "QTMOBILITY_${_COMPONENT}_INCLUDE_DIR" "QTMOBILITY_${_COMPONENT}_LIBRARY")
 
95
        list(APPEND QTMOBILITY_INCLUDE_DIRS ${QTMOBILITY_${_COMPONENT}_INCLUDE_DIR})
 
96
        list(APPEND QTMOBILITY_LIBRARIES ${QTMOBILITY_${_COMPONENT}_LIBRARY})
 
97
    endif (NOT QtMobility_FIND_COMPONENTS OR QTMOBILITY_USE_${_COMPONENT})
 
98
endforeach (index)
 
99
 
 
100
include(FindPackageHandleStandardArgs)
 
101
find_package_handle_standard_args(QtMobility REQUIRED_VARS ${QTMOBILITY_VARIABLES} VERSION_VAR QTMOBILITY_VERSION)
 
102
 
 
103
mark_as_advanced(${QTMOBILITY_VARIABLES})