1
# - Try to find the QtMobility libraries
3
# This module will search for the QtMobility libraries.
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
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.
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.
22
# Note that searching for components will be limited to the specified components
23
# if the components option is used.
25
# Copyright (c) 2011 Arjen Hiemstra <ahiemstra@heimr.nl>
26
# Redistribution and use is allowed according to the terms of the BSD license.
28
set(QTMOBILITY_COMPONENTS
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)
52
find_path(QTMOBILITY_INCLUDE_DIR qmobilityglobal.h PATH_SUFFIXES QtMobility)
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)
61
set(QTMOBILITY_VARIABLES "QTMOBILITY_INCLUDE_DIR")
63
set(QTMOBILITY_INCLUDE_DIRS ${QTMOBILITY_INCLUDE_DIR})
65
#A list of files to find for specific components
66
set(QTMOBILITY_FIND_FILES
67
QNetworkConfiguration #Bearer
68
QBluetoothSocket #Connectivity
70
QFeedbackInterface #Feedback
71
QAbstractGallery #Gallery
74
QMediaPlayer #MultimediaKit
75
QOrganizerItem #Organizer
76
QValueSpace #PublishSubscribe
78
QService #ServiceFramework
79
QSystemInfo #SystemInfo
80
QVersitDocument #Versit
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)
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})
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})
100
include(FindPackageHandleStandardArgs)
101
find_package_handle_standard_args(QtMobility REQUIRED_VARS ${QTMOBILITY_VARIABLES} VERSION_VAR QTMOBILITY_VERSION)
103
mark_as_advanced(${QTMOBILITY_VARIABLES})