~dobey/indicator-datetime/build-parallel

« back to all changes in this revision

Viewing changes to cmake/UseGSettings.cmake

  • Committer: Charles Kerr
  • Date: 2013-10-18 19:22:54 UTC
  • mto: This revision was merged to the branch mainline in revision 281.
  • Revision ID: charles.kerr@canonical.com-20131018192254-mga1w5zccemycadl
replace autotools with cmake

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