~charlesk/indicator-datetime/lp-1251460

« back to all changes in this revision

Viewing changes to cmake/UseGSettings.cmake

  • Committer: Tarmac
  • Author(s): Charles Kerr
  • Date: 2013-10-30 23:49:58 UTC
  • mfrom: (277.3.13 cmakeify)
  • Revision ID: tarmac-20131030234958-jpw5u72656f8mdf2
Switch the build system to cmake. Fixes: https://bugs.launchpad.net/bugs/1237509.

Approved by Ted Gould, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them.
 
2
 
 
3
macro(add_schema SCHEMA_NAME)
 
4
 
 
5
    set(PKG_CONFIG_EXECUTABLE pkg-config)
 
6
    set(GSETTINGS_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/glib-2.0/schemas")
 
7
 
 
8
    # Run the validator and error if it fails
 
9
    execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas  OUTPUT_VARIABLE _glib_compile_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
 
10
    execute_process (COMMAND ${_glib_compile_schemas} --dry-run --schema-file=${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
 
11
 
 
12
    if (_schemas_invalid)
 
13
      message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
 
14
    endif (_schemas_invalid)
 
15
 
 
16
    # Actually install and recomple schemas
 
17
    message (STATUS "${GSETTINGS_DIR} is the GSettings install dir")
 
18
    install (FILES ${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
 
19
 
 
20
    install (CODE "message (STATUS \"Compiling GSettings schemas\")")
 
21
    install (CODE "execute_process (COMMAND ${_glib_compile_schemas} ${GSETTINGS_DIR})")
 
22
endmacro()
 
23