1
# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them.
3
macro(add_schema SCHEMA_NAME)
5
set(PKG_CONFIG_EXECUTABLE pkg-config)
6
set(GSETTINGS_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/glib-2.0/schemas")
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)
13
message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
14
endif (_schemas_invalid)
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)
20
install (CODE "message (STATUS \"Compiling GSettings schemas\")")
21
install (CODE "execute_process (COMMAND ${_glib_compile_schemas} ${GSETTINGS_DIR})")