2
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
2
# Copyright 2009-2010 Jakob Westhoff, 2014 Raster Software Vigo
4
5
# Redistribution and use in source and binary forms, with or without
5
6
# modification, are permitted provided that the following conditions are met:
46
47
# Search for the valac executable in the usual system paths.
47
find_program(VALA_EXECUTABLE
48
find_program(VALA_EXECUTABLE NAMES valac)
50
if (VALA_EXECUTABLE STREQUAL "VALA_EXECUTABLE-NOTFOUND")
52
# if valac executable is not found, it can be that valac is not installed, or
53
# that the OS is source-based (like gentoo), and doesn't do a link from
54
# valac-X.YY to valac. In that case, search for the specific valac binary after
56
if (NOT VALA_DEFERRING_COMPILER_SEARCH)
57
message (STATUS "VALAC not found. Deferring compiler search")
58
endif(NOT VALA_DEFERRING_COMPILER_SEARCH)
59
set(VALA_DEFERRING_COMPILER_SEARCH TRUE)
60
unset(VALA_EXECUTABLE)
63
else(VALA_EXECUTABLE STREQUAL "VALA_EXECUTABLE-NOTFOUND")
50
65
# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
51
66
# Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
52
67
# VALA_EXECUTABLE is set)
54
include(FindPackageHandleStandardArgs)
55
find_package_handle_standard_args(Vala DEFAULT_MSG VALA_EXECUTABLE)
69
include(FindPackageHandleStandardArgs)
70
find_package_handle_standard_args(Vala DEFAULT_MSG VALA_EXECUTABLE)
57
mark_as_advanced(VALA_EXECUTABLE)
72
mark_as_advanced(VALA_EXECUTABLE)
59
74
# Determine the valac version
61
execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
62
OUTPUT_VARIABLE "VALA_VERSION")
63
string(REPLACE "Vala" "" "VALA_VERSION" ${VALA_VERSION})
64
string(STRIP ${VALA_VERSION} "VALA_VERSION")
76
execute_process(COMMAND ${VALA_EXECUTABLE} "--version" OUTPUT_VARIABLE "VALA_VERSION")
77
string(REPLACE "Vala" "" "VALA_VERSION" ${VALA_VERSION})
78
string(STRIP ${VALA_VERSION} "VALA_VERSION")
80
endif(VALA_EXECUTABLE STREQUAL "VALA_EXECUTABLE-NOTFOUND")