1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
From: Andras Mantia <amantia@kde.org>
Date: Thu, 10 Nov 2011 08:43:52 +0000
Subject: Use the global FindPhonon.cmake that really finds Phonon.
X-Git-Url: http://quickgit.kde.org/?p=phonon-xine.git&a=commitdiff&h=8c7fab4e433b53ac2f00093f1f464e0178c2d3e1
---
Use the global FindPhonon.cmake that really finds Phonon.
---
--- a/cmake/FindPhonon.cmake
+++ /dev/null
@@ -1,53 +0,0 @@
-# Find Phonon
-
-# Copyright (c) 2010, Harald Sitter <sitter@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 (NOT PHONON_BUILDSYSTEM_DIR)
- find_program(PC_EXECUTABLE NAMES pkg-config
- PATH_SUFFIXES bin
- HINTS
- ${CMAKE_INSTALL_PREFIX}
- ONLY_CMAKE_FIND_ROOT_PATH
- )
-
- if (NOT PC_EXECUTABLE)
- if (Phonon_FIND_REQUIRED)
- message(FATAL_ERROR "ERROR: Could not find pkg-config [required to find Phonon].")
- endif (Phonon_FIND_REQUIRED)
- endif (NOT PC_EXECUTABLE)
-
- if (PC_EXECUTABLE)
- execute_process(COMMAND "${PC_EXECUTABLE}" --variable=buildsystemdir phonon
- OUTPUT_VARIABLE _data_DIR
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- file(TO_CMAKE_PATH "${_data_DIR}" _data_DIR)
- find_path(PHONON_BUILDSYSTEM_DIR FindPhononInternal.cmake HINTS ${_data_DIR})
- endif (PC_EXECUTABLE)
-endif (NOT PHONON_BUILDSYSTEM_DIR)
-
-if (PHONON_BUILDSYSTEM_DIR)
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PHONON_BUILDSYSTEM_DIR})
-
- if (Phonon_FIND_REQUIRED)
- set(_req REQUIRED)
- endif (Phonon_FIND_REQUIRED)
- if (PHONON_FIND_QUIETLY)
- set(_quiet QUIET)
- endif (PHONON_FIND_QUIETLY)
-
- find_package(PhononInternal ${_req} ${_quiet})
-else (PHONON_BUILDSYSTEM_DIR)
- if (_data_DIR)
- if (Phonon_FIND_REQUIRED)
- message(FATAL_ERROR "ERROR: FindPhonon.cmake not found in ${_data_DIR}")
- endif (Phonon_FIND_REQUIRED)
- else (_data_DIR)
- if (Phonon_FIND_REQUIRED)
- message(FATAL_ERROR "ERROR: Either pkg-config can not find its phonon config, or you are not using a recent enough Phonon version.")
- endif (Phonon_FIND_REQUIRED)
- endif (_data_DIR)
-endif (PHONON_BUILDSYSTEM_DIR)
--- /dev/null
+++ b/cmake/MacroEnsureVersion.cmake
@@ -0,0 +1,117 @@
+# This file defines the following macros for developers to use in ensuring
+# that installed software is of the right version:
+#
+# MACRO_ENSURE_VERSION - test that a version number is greater than
+# or equal to some minimum
+# MACRO_ENSURE_VERSION_RANGE - test that a version number is greater than
+# or equal to some minimum and less than some
+# maximum
+# MACRO_ENSURE_VERSION2 - deprecated, do not use in new code
+#
+
+# MACRO_ENSURE_VERSION
+# This macro compares version numbers of the form "x.y.z" or "x.y"
+# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
+# will set FOO_VERSION_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
+# Leading and trailing text is ok, e.g.
+# MACRO_ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK)
+# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system
+
+# Copyright (c) 2006, David Faure, <faure@kde.org>
+# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# MACRO_ENSURE_VERSION_RANGE
+# This macro ensures that a version number of the form
+# "x.y.z" or "x.y" falls within a range defined by
+# min_version <= found_version < max_version.
+# If this expression holds, FOO_VERSION_OK will be set TRUE
+#
+# Example: MACRO_ENSURE_VERSION_RANGE3( "0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK )
+#
+# This macro will break silently if any of x,y,z are greater than 100.
+#
+# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# NORMALIZE_VERSION
+# Helper macro to convert version numbers of the form "x.y.z"
+# to an integer equal to 10^4 * x + 10^2 * y + z
+#
+# This macro will break silently if any of x,y,z are greater than 100.
+#
+# Copyright (c) 2006, David Faure, <faure@kde.org>
+# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# CHECK_RANGE_INCLUSIVE_LOWER
+# Helper macro to check whether x <= y < z
+#
+# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+MACRO(NORMALIZE_VERSION _requested_version _normalized_version)
+ STRING(REGEX MATCH "[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+.*" _threePartMatch "${_requested_version}")
+ if (_threePartMatch)
+ # parse the parts of the version string
+ STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major_vers "${_requested_version}")
+ STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" _minor_vers "${_requested_version}")
+ STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" _patch_vers "${_requested_version}")
+ else (_threePartMatch)
+ STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+" "\\1" _major_vers "${_requested_version}")
+ STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)" "\\1" _minor_vers "${_requested_version}")
+ set(_patch_vers "0")
+ endif (_threePartMatch)
+
+ # compute an overall version number which can be compared at once
+ MATH(EXPR ${_normalized_version} "${_major_vers}*10000 + ${_minor_vers}*100 + ${_patch_vers}")
+ENDMACRO(NORMALIZE_VERSION)
+
+MACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok)
+ if (${_value} LESS ${_lower_limit})
+ set( ${_ok} FALSE )
+ elseif (${_value} EQUAL ${_lower_limit})
+ set( ${_ok} TRUE )
+ elseif (${_value} EQUAL ${_upper_limit})
+ set( ${_ok} FALSE )
+ elseif (${_value} GREATER ${_upper_limit})
+ set( ${_ok} FALSE )
+ else (${_value} LESS ${_lower_limit})
+ set( ${_ok} TRUE )
+ endif (${_value} LESS ${_lower_limit})
+ENDMACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER)
+
+MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old)
+ NORMALIZE_VERSION( ${requested_version} req_vers_num )
+ NORMALIZE_VERSION( ${found_version} found_vers_num )
+
+ if (found_vers_num LESS req_vers_num)
+ set( ${var_too_old} FALSE )
+ else (found_vers_num LESS req_vers_num)
+ set( ${var_too_old} TRUE )
+ endif (found_vers_num LESS req_vers_num)
+
+ENDMACRO(MACRO_ENSURE_VERSION)
+
+MACRO(MACRO_ENSURE_VERSION2 requested_version2 found_version2 var_too_old2)
+ MACRO_ENSURE_VERSION( ${requested_version2} ${found_version2} ${var_too_old2})
+ENDMACRO(MACRO_ENSURE_VERSION2)
+
+MACRO(MACRO_ENSURE_VERSION_RANGE min_version found_version max_version var_ok)
+ NORMALIZE_VERSION( ${min_version} req_vers_num )
+ NORMALIZE_VERSION( ${found_version} found_vers_num )
+ NORMALIZE_VERSION( ${max_version} max_vers_num )
+
+ MACRO_CHECK_RANGE_INCLUSIVE_LOWER( ${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok})
+ENDMACRO(MACRO_ENSURE_VERSION_RANGE)
+
+
|