Debian Codegraph @

cmake/FindVala.cmake

raw
1 # - Find Vala
2 # This module looks for valac.
3 # This module defines the following values:
4 # VALA_FOUND
5 # VALA_COMPILER
6 # VALA_VERSION
7 # VAPI_GEN
8 # VAPI_GEN_VERSION
9
10 #=============================================================================
11 # Copyright Přemysl Janouch 2011
12 # All rights reserved.
13 #
14 # Redistribution and use in source and binary forms, with or without
15 # modification, are permitted provided that the following conditions are met:
16 # * Redistributions of source code must retain the above copyright
17 # notice, this list of conditions and the following disclaimer.
18 # * Redistributions in binary form must reproduce the above copyright
19 # notice, this list of conditions and the following disclaimer in the
20 # documentation and/or other materials provided with the distribution.
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
23 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
26 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
32 # OF SUCH DAMAGE.
33 #=============================================================================
34
35 find_program (VALA_COMPILER "valac")
36
37 if (VALA_COMPILER)
38 execute_process (COMMAND ${VALA_COMPILER} --version
39 OUTPUT_VARIABLE VALA_VERSION)
40 string (REGEX MATCH "[.0-9]+" VALA_VERSION "${VALA_VERSION}")
41 endif (VALA_COMPILER)
42
43 find_program (VAPI_GEN "vapigen")
44
45 if (VAPI_GEN)
46 execute_process (COMMAND ${VAPI_GEN} --version
47 OUTPUT_VARIABLE VAPI_GEN_VERSION)
48 string (REGEX MATCH "[.0-9]+" VAPI_GEN_VERSION "${VAPI_GEN_VERSION}")
49 endif (VAPI_GEN)
50
51 include (FindPackageHandleStandardArgs)
52 FIND_PACKAGE_HANDLE_STANDARD_ARGS (Vala
53 REQUIRED_VARS VALA_COMPILER
54 VERSION_VAR VALA_VERSION)
55
56 mark_as_advanced (VALA_COMPILER VALA_VERSION VAPI_GEN)
57