152
by xapantu
Cleanup the build system (use a proper translation system, and use our cmake modules) |
1 |
##
|
2 |
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
|
|
3 |
#
|
|
4 |
# Redistribution and use in source and binary forms, with or without
|
|
5 |
# modification, are permitted provided that the following conditions are met:
|
|
6 |
#
|
|
7 |
# 1. Redistributions of source code must retain the above copyright notice,
|
|
8 |
# this list of conditions and the following disclaimer.
|
|
9 |
#
|
|
10 |
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11 |
# this list of conditions and the following disclaimer in the documentation
|
|
12 |
# and/or other materials provided with the distribution.
|
|
13 |
#
|
|
14 |
# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
|
|
15 |
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
16 |
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
17 |
# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
18 |
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
19 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
20 |
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
21 |
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
22 |
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
23 |
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24 |
#
|
|
25 |
# The views and conclusions contained in the software and documentation are those
|
|
26 |
# of the authors and should not be interpreted as representing official policies,
|
|
27 |
# either expressed or implied, of Jakob Westhoff
|
|
28 |
##
|
|
29 |
||
30 |
include(ParseArguments) |
|
31 |
find_package(Vala REQUIRED) |
|
32 |
||
33 |
##
|
|
34 |
# Ensure a certain valac version is available
|
|
35 |
#
|
|
36 |
# The initial argument is the version to check for
|
|
37 |
#
|
|
38 |
# It may be followed by a optional parameter to specifiy a version range. The
|
|
39 |
# following options are valid:
|
|
40 |
#
|
|
41 |
# EXACT
|
|
42 |
# Vala needs to be available in the exact version given
|
|
43 |
#
|
|
44 |
# MINIMUM
|
|
45 |
# The provided version is the minimum version. Therefore Vala needs to be
|
|
46 |
# available in the given version or any higher version
|
|
47 |
#
|
|
48 |
# MAXIMUM
|
|
49 |
# The provided version is the maximum. Therefore Vala needs to be available
|
|
50 |
# in the given version or any version older than this
|
|
51 |
#
|
|
52 |
# If no option is specified the version will be treated as a minimal version.
|
|
53 |
##
|
|
54 |
macro(ensure_vala_version version) |
|
55 |
parse_arguments(ARGS "" "MINIMUM;MAXIMUM;EXACT" ${ARGN}) |
|
56 |
set(compare_message "") |
|
57 |
set(error_message "") |
|
58 |
if(ARGS_MINIMUM) |
|
59 |
set(compare_message "a minimum ") |
|
60 |
set(error_message "or greater ") |
|
61 |
elseif(ARGS_MAXIMUM) |
|
62 |
set(compare_message "a maximum ") |
|
63 |
set(error_message "or less ") |
|
64 |
endif(ARGS_MINIMUM) |
|
65 |
||
66 |
message(STATUS |
|
67 |
"checking for ${compare_message}Vala version of ${version}"
|
|
68 |
)
|
|
69 |
||
70 |
unset(version_accepted) |
|
71 |
||
72 |
# MINIMUM is the default if no option is specified
|
|
73 |
if(ARGS_EXACT) |
|
74 |
if(${VALA_VERSION} VERSION_EQUAL ${version} ) |
|
75 |
set(version_accepted TRUE) |
|
76 |
endif(${VALA_VERSION} VERSION_EQUAL ${version}) |
|
77 |
elseif(ARGS_MAXIMUM) |
|
78 |
if(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version}) |
|
79 |
set(version_accepted TRUE) |
|
80 |
endif(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version}) |
|
81 |
else(ARGS_MAXIMUM) |
|
82 |
if(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version}) |
|
83 |
set(version_accepted TRUE) |
|
84 |
endif(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version}) |
|
85 |
endif(ARGS_EXACT) |
|
86 |
||
87 |
if (NOT version_accepted) |
|
88 |
message(FATAL_ERROR |
|
89 |
"Vala version ${version} ${error_message}is required."
|
|
90 |
)
|
|
91 |
endif(NOT version_accepted) |
|
92 |
||
93 |
message(STATUS |
|
94 |
" found Vala, version ${VALA_VERSION}"
|
|
95 |
)
|
|
96 |
endmacro(ensure_vala_version) |