2
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
4
# Redistribution and use in source and binary forms, with or without
5
# modification, are permitted provided that the following conditions are met:
7
# 1. Redistributions of source code must retain the above copyright notice,
8
# this list of conditions and the following disclaimer.
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.
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.
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
30
include(ParseArguments)
31
find_package(Vala REQUIRED)
34
# Ensure a certain valac version is available
36
# The initial argument is the version to check for
38
# It may be followed by a optional parameter to specifiy a version range. The
39
# following options are valid:
42
# Vala needs to be available in the exact version given
45
# The provided version is the minimum version. Therefore Vala needs to be
46
# available in the given version or any higher version
49
# The provided version is the maximum. Therefore Vala needs to be available
50
# in the given version or any version older than this
52
# If no option is specified the version will be treated as a minimal version.
54
macro(ensure_vala_version version)
55
parse_arguments(ARGS "" "MINIMUM;MAXIMUM;EXACT" ${ARGN})
56
set(compare_message "")
59
set(compare_message "a minimum ")
60
set(error_message "or greater ")
62
set(compare_message "a maximum ")
63
set(error_message "or less ")
67
"checking for ${compare_message}Vala version of ${version}"
70
unset(version_accepted)
72
# MINIMUM is the default if no option is specified
74
if(${VALA_VERSION} VERSION_EQUAL ${version} )
75
set(version_accepted TRUE)
76
endif(${VALA_VERSION} VERSION_EQUAL ${version})
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})
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})
87
if (NOT version_accepted)
89
"Vala version ${version} ${error_message}is required."
91
endif(NOT version_accepted)
94
" found Vala, version ${VALA_VERSION}"
96
endmacro(ensure_vala_version)