~writer-devs/writer/trunk

« back to all changes in this revision

Viewing changes to cmake/FindVala.cmake

  • Committer: harp37 at gmail
  • Date: 2014-11-25 00:55:20 UTC
  • mto: This revision was merged to the branch mainline in revision 70.
  • Revision ID: harp37@gmail.com-20141125005520-6ax4j204vr1bby2i
CMake is nearly there.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
##
2
 
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
 
2
# Copyright 2009-2010 Jakob Westhoff, 2014 Raster Software Vigo
 
3
# All rights reserved.
3
4
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:
44
45
 
45
46
 
46
47
# Search for the valac executable in the usual system paths.
47
 
find_program(VALA_EXECUTABLE
48
 
  NAMES valac)
 
48
find_program(VALA_EXECUTABLE NAMES valac)
 
49
 
 
50
if (VALA_EXECUTABLE STREQUAL "VALA_EXECUTABLE-NOTFOUND")
 
51
 
 
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
 
55
 
 
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)
 
61
        unset(VALA_VERSION)
 
62
 
 
63
else(VALA_EXECUTABLE STREQUAL "VALA_EXECUTABLE-NOTFOUND")
49
64
 
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)
53
68
 
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)
56
71
 
57
 
mark_as_advanced(VALA_EXECUTABLE)
 
72
        mark_as_advanced(VALA_EXECUTABLE)
58
73
 
59
74
# Determine the valac version
60
 
if(VALA_FOUND)
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")
65
 
endif(VALA_FOUND)
 
75
        if(VALA_FOUND)
 
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")
 
79
        endif(VALA_FOUND)
 
80
endif(VALA_EXECUTABLE STREQUAL "VALA_EXECUTABLE-NOTFOUND")