File: FindGObjectIntrospection.cmake

package info (click to toggle)
qtwebkit-opensource-src 5.212.0~alpha4-42
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 126,656 kB
  • sloc: cpp: 1,399,223; javascript: 111,961; ansic: 29,742; perl: 19,510; python: 13,364; ruby: 10,299; xml: 9,342; asm: 5,078; yacc: 2,166; lex: 906; sh: 417; makefile: 31
file content (60 lines) | stat: -rw-r--r-- 2,154 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# - Try to find gobject-introspection
# Once done, this will define
#
#  INTROSPECTION_FOUND - system has gobject-introspection
#  INTROSPECTION_SCANNER - the gobject-introspection scanner, g-ir-scanner
#  INTROSPECTION_COMPILER - the gobject-introspection compiler, g-ir-compiler
#  INTROSPECTION_GENERATE - the gobject-introspection generate, g-ir-generate
#  INTROSPECTION_GIRDIR
#  INTROSPECTION_TYPELIBDIR
#  INTROSPECTION_CFLAGS
#  INTROSPECTION_LIBS
#
# Copyright (C) 2010, Pino Toscano, <pino@kde.org>
# Copyright (C) 2014 Igalia S.L.
#
# Redistribution and use is allowed according to the terms of the BSD license.

macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname _extra_args)
    execute_process(
        COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} ${_extra_args} gobject-introspection-1.0
        OUTPUT_VARIABLE _result
        RESULT_VARIABLE _null
    )

    if (_null)
    else ()
        string(REGEX REPLACE "[\r\n]" " " _result "${_result}")
        string(REGEX REPLACE " +$" ""  _result "${_result}")
        separate_arguments(_result)
        set(${_outvar} ${_result} CACHE INTERNAL "")
    endif ()
endmacro(_GIR_GET_PKGCONFIG_VAR)

find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
    if (PACKAGE_FIND_VERSION_COUNT GREATER 0)
        set(_gir_version_cmp ">=${PACKAGE_FIND_VERSION}")
    endif ()
    pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp})
    if (_pc_gir_FOUND)
        set(INTROSPECTION_FOUND TRUE)
        _gir_get_pkgconfig_var(INTROSPECTION_SCANNER "g_ir_scanner" "")
        _gir_get_pkgconfig_var(INTROSPECTION_COMPILER "g_ir_compiler" "")
        _gir_get_pkgconfig_var(INTROSPECTION_GENERATE "g_ir_generate" "")
        _gir_get_pkgconfig_var(INTROSPECTION_GIRDIR "girdir" "")
        _gir_get_pkgconfig_var(INTROSPECTION_TYPELIBDIR "typelibdir" "")
        set(INTROSPECTION_CFLAGS "${_pc_gir_CFLAGS}")
        set(INTROSPECTION_LIBS "${_pc_gir_LIBS}")
    endif ()
endif ()

mark_as_advanced(
    INTROSPECTION_SCANNER
    INTROSPECTION_COMPILER
    INTROSPECTION_GENERATE
    INTROSPECTION_GIRDIR
    INTROSPECTION_TYPELIBDIR
    INTROSPECTION_CFLAGS
    INTROSPECTION_LIBS
)