/+junk/libgego

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/libgego

« back to all changes in this revision

Viewing changes to cmake/FindGObjectIntrospection.cmake

  • Committer: Gustav Hartvigsson
  • Date: 2015-06-01 20:38:00 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150601203800-ymkb9tmijhd4dkby
* Initial code.
* Bulding does not work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# - try to find gobject-introspection
 
2
#
 
3
# Once done this will define
 
4
#
 
5
#  INTROSPECTION_FOUND - system has gobject-introspection
 
6
#  INTROSPECTION_SCANNER - the gobject-introspection scanner, g-ir-scanner
 
7
#  INTROSPECTION_COMPILER - the gobject-introspection compiler, g-ir-compiler
 
8
#  INTROSPECTION_GENERATE - the gobject-introspection generate, g-ir-generate
 
9
#  INTROSPECTION_GIRDIR
 
10
#  INTROSPECTION_TYPELIBDIR
 
11
#  INTROSPECTION_CFLAGS
 
12
#  INTROSPECTION_LIBS
 
13
#
 
14
# Copyright (C) 2010, Pino Toscano, <pino@kde.org>
 
15
#
 
16
# Redistribution and use is allowed according to the terms of the BSD license.
 
17
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 
18
 
 
19
macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname)
 
20
  execute_process(
 
21
    COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} gobject-introspection-1.0
 
22
    OUTPUT_VARIABLE _result
 
23
    RESULT_VARIABLE _null
 
24
  )
 
25
 
 
26
  if (_null)
 
27
  else()
 
28
    string(REGEX REPLACE "[\r\n]" " " _result "${_result}")
 
29
    string(REGEX REPLACE " +$" ""  _result "${_result}")
 
30
    separate_arguments(_result)
 
31
    set(${_outvar} ${_result} CACHE INTERNAL "")
 
32
  endif()
 
33
endmacro(_GIR_GET_PKGCONFIG_VAR)
 
34
 
 
35
find_package(PkgConfig)
 
36
if(PKG_CONFIG_FOUND)
 
37
  if(PACKAGE_FIND_VERSION_COUNT GREATER 0)
 
38
    set(_gir_version_cmp ">=${PACKAGE_FIND_VERSION}")
 
39
  endif()
 
40
  pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp})
 
41
  if(_pc_gir_FOUND)
 
42
    set(INTROSPECTION_FOUND TRUE)
 
43
    _gir_get_pkgconfig_var(INTROSPECTION_SCANNER "g_ir_scanner")
 
44
    _gir_get_pkgconfig_var(INTROSPECTION_COMPILER "g_ir_compiler")
 
45
    _gir_get_pkgconfig_var(INTROSPECTION_GENERATE "g_ir_generate")
 
46
    _gir_get_pkgconfig_var(INTROSPECTION_GIRDIR "girdir")
 
47
    _gir_get_pkgconfig_var(INTROSPECTION_TYPELIBDIR "typelibdir")
 
48
    set(INTROSPECTION_CFLAGS "${_pc_gir_CFLAGS}")
 
49
    set(INTROSPECTION_LIBS "${_pc_gir_LIBS}")
 
50
  endif()
 
51
endif()
 
52
 
 
53
mark_as_advanced(
 
54
  INTROSPECTION_SCANNER
 
55
  INTROSPECTION_COMPILER
 
56
  INTROSPECTION_GENERATE
 
57
  INTROSPECTION_GIRDIR
 
58
  INTROSPECTION_TYPELIBDIR
 
59
  INTROSPECTION_CFLAGS
 
60
  INTROSPECTION_LIBS
 
61
)