3 set(MOBILITY_CONFIG_MKSPECS_FILE "")
4 IF(EXISTS "${QT_MKSPECS_DIR}/features/mobilityconfig.prf")
5 set(MOBILITY_CONFIG_MKSPECS_FILE "${QT_MKSPECS_DIR}/features/mobilityconfig.prf")
6 ELSEIF(EXISTS "${QT_MKSPECS_DIR}/features/mobility.prf")
7 set(MOBILITY_CONFIG_MKSPECS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/mobilityconfig.prf")
10 macro(export_component component)
11 IF(NOT ${MOBILITY_CONFIG_MKSPECS_FILE} STREQUAL "")
12 FILE(READ ${MOBILITY_CONFIG_MKSPECS_FILE} MOBILITY_FILE_CONTENTS)
13 STRING(TOLOWER ${component} _COMPONENT)
14 IF(${MOBILITY_FILE_CONTENTS} MATCHES "MOBILITY_CONFIG=.*${_COMPONENT}.*")
15 STRING(TOUPPER ${component} _COMPONENT)
16 SET(QT_MOBILITY_${_COMPONENT}_FOUND 1)
17 SET(QT_MOBILITY_${_COMPONENT}_INCLUDE_DIR ${QT_MOBILITY_PARENT_INCLUDE_DIR}/Qt${component})
18 SET(QT_MOBILITY_${_COMPONENT}_LIBRARY Qt${component})
24 set(FEATURE_FILE_PREFIX "${QT_MKSPECS_DIR}/features/mobility")
26 if(DEFINED MOBILITY_VERSION)
27 if(MOBILITY_VERSION STREQUAL "1.1" AND EXISTS "${FEATURE_FILE_PREFIX}11.prf")
28 set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}11.prf")
29 set(VERSION_INFO "1.1")
30 elseif(MOBILITY_VERSION STREQUAL "1.2" AND EXISTS "${FEATURE_FILE_PREFIX}12.prf")
31 set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}12.prf")
32 set(VERSION_INFO "1.2")
33 elseif(MOBILITY_VERSION STREQUAL "default" AND EXISTS "${FEATURE_FILE_PREFIX}.prf")
34 set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}.prf")
35 set(VERSION_INFO "system's default")
37 message(STATUS "Couldn't find QtMobility version: ${MOBILITY_VERSION}")
41 if(NOT DEFINED MOBILITY_PRF_FILE)
42 if(EXISTS "${FEATURE_FILE_PREFIX}.prf")
43 set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}.prf")
44 set(VERSION_INFO "system's default")
45 elseif(EXISTS "${FEATURE_FILE_PREFIX}12.prf")
46 set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}12.prf")
47 set(VERSION_INFO "1.2")
48 elseif(EXISTS "${FEATURE_FILE_PREFIX}11.prf")
49 set(MOBILITY_PRF_FILE "${FEATURE_FILE_PREFIX}11.prf")
50 set(VERSION_INFO "1.1")
52 message(FATAL_ERROR "Couldn't find any version of QtMobility.")
56 message(STATUS "Using QtMobility version: ${VERSION_INFO}")
58 IF(DEFINED MOBILITY_PRF_FILE)
59 FILE(READ ${MOBILITY_PRF_FILE} MOBILITY_FILE_CONTENTS)
61 STRING(REGEX MATCH "MOBILITY_PREFIX=([^\n]+)" QT_MOBILITY_PREFIX "${MOBILITY_FILE_CONTENTS}")
62 SET(QT_MOBILITY_PREFIX ${CMAKE_MATCH_1})
64 STRING(REGEX MATCH "MOBILITY_INCLUDE=([^\n]+)" QT_MOBILITY_INCLUDE_DIR "${MOBILITY_FILE_CONTENTS}")
65 SET(QT_MOBILITY_INCLUDE_DIR ${CMAKE_MATCH_1})
67 STRING(REGEX MATCH "MOBILITY_LIB=([^\n]+)" "\\1" QT_MOBILITY_LIBRARY "${MOBILITY_FILE_CONTENTS}")
68 SET(QT_MOBILITY_LIBRARY_DIR ${CMAKE_MATCH_1})
71 IF(NOT ${MOBILITY_CONFIG_MKSPECS_FILE} STREQUAL "")
72 FILE(READ ${MOBILITY_CONFIG_MKSPECS_FILE} MOBILITY_CONFIG_FILE_CONTENTS)
73 STRING(REGEX MATCH "MOBILITY_VERSION = ([^\n]+)" QT_MOBILITY_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
74 SET(QT_MOBILITY_VERSION ${CMAKE_MATCH_1})
76 STRING(REGEX MATCH "MOBILITY_MAJOR_VERSION = ([^\n]+)" QT_MOBILITY_MAJOR_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
77 SET(QT_MOBILITY_MAJOR_VERSION ${CMAKE_MATCH_1})
79 STRING(REGEX MATCH "MOBILITY_MINOR_VERSION = ([^\n]+)" QT_MOBILITY_MINOR_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
80 SET(QT_MOBILITY_MINOR_VERSION ${CMAKE_MATCH_1})
82 STRING(REGEX MATCH "MOBILITY_PATCH_VERSION = ([^\n]+)" QT_MOBILITY_PATCH_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
83 SET(QT_MOBILITY_PATCH_VERSION ${CMAKE_MATCH_1})
85 message(STATUS "QtMobility version: ${QT_MOBILITY_VERSION}")
87 SET(QT_MOBILITY_VERSION 1.0.0)
88 SET(QT_MOBILITY_MAJOR_VERSION 1)
89 SET(QT_MOBILITY_MINOR_VERSION 0)
90 SET(QT_MOBILITY_PATCH_VERSION 0)
93 SET(QT_MOBILITY_PARENT_INCLUDE_DIR ${QT_MOBILITY_INCLUDE_DIR})
94 SET(QT_MOBILITY_INCLUDE_DIR ${QT_MOBILITY_INCLUDE_DIR}/QtMobility)
96 IF(QtMobility_FIND_VERSION_EXACT)
97 IF(QT_MOBILITY_VERSION VERSION_EQUAL QtMobility_FIND_VERSION)
98 SET(QT_MOBILITY_FOUND TRUE)
100 SET(QT_MOBILITY_FOUND FALSE)
101 IF(QT_MOBILITY_VERSION VERSION_LESS QtMobility_FIND_VERSION)
102 SET(QT_MOBILITY_TOO_OLD TRUE)
104 SET(QT_MOBILITY_TOO_NEW TRUE)
108 IF(QT_MOBILITY_VERSION VERSION_LESS QtMobility_FIND_VERSION)
109 SET(QT_MOBILITY_FOUND FALSE)
110 SET(QT_MOBILITY_TOO_OLD TRUE)
112 SET(QT_MOBILITY_FOUND TRUE)
116 SET(QT_MOBILITY_FOUND NOTFOUND)
117 SET(QT_MOBILITY_PREFIX NOTFOUND)
118 SET(QT_MOBILITY_INCLUDE NOTFOUND)
119 SET(QT_MOBILITY_LIB NOTFOUND)
122 IF(NOT QT_MOBILITY_FOUND)
123 if(QT_MOBILITY_TOO_OLD)
124 MESSAGE(FATAL_ERROR "The installed QtMobility version ${QT_MOBILITY_VERSION} it too old, version ${QtMobility_FIND_VERSION} is required.")
125 ELSEIF(QT_MOBILITY_TOO_NEW)
126 MESSAGE(FATAL_ERROR "The installed QtMobility version ${QT_MOBILITY_VERSION} it too new, version ${QtMobility_FIND_VERSION} is required.")
128 MESSAGE(FATAL_ERROR "QtMobility not found.")
131 export_component(Bearer)
132 export_component(Feedback)
133 export_component(Gallery)
134 export_component(PublishSubscribe)
135 export_component(Location)
136 export_component(Organizer)
137 export_component(ServiceFramework)
138 export_component(SystemInfo)
139 export_component(Contacts)
140 export_component(Connectivity)
141 export_component(Messaging)
142 export_component(Versit)
143 export_component(Sensors)
145 if(QT_MOBILITY_VERSIT_FOUND AND QT_MOBILITY_ORGANIZER_FOUND)
146 SET(QT_MOBILITY_VERSITORGANIZER_FOUND 1)
147 SET(QT_MOBILITY_VERSITORGANIZER_INCLUDE_DIR ${QT_MOBILITY_PARENT_INCLUDE_DIR}/QtVersitOrganizer)
148 SET(QT_MOBILITY_VERSITORGANIZER_LIBRARY QtVersitOrganizer)
151 # MultimediaKit - it's just 'multimedia' in the .prf file.
152 IF(NOT ${MOBILITY_CONFIG_MKSPECS_FILE} STREQUAL "")
153 FILE(READ ${MOBILITY_CONFIG_MKSPECS_FILE} MOBILITY_FILE_CONTENTS)
154 IF(${MOBILITY_FILE_CONTENTS} MATCHES "MOBILITY_CONFIG=.*multimedia.*")
155 SET(QT_MOBILITY_MULTIMEDIAKIT_FOUND 1)
156 SET(QT_MOBILITY_MULTIMEDIAKIT_INCLUDE_DIR ${QT_MOBILITY_PARENT_INCLUDE_DIR}/QtMultimediaKit)
157 SET(QT_MOBILITY_MULTIMEDIAKIT_LIBRARY QtMultimediaKit)