aboutsummaryrefslogtreecommitdiff
path: root/cmake/UseGSettings.cmake
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-09-08 22:58:48 -0500
committerTed Gould <ted@gould.cx>2014-09-08 22:58:48 -0500
commit334e3b3130cbde5a96e6da5323d40418db80f8ef (patch)
tree299d5e2a5cdaab892fe7c92b9405f721635124e3 /cmake/UseGSettings.cmake
parentcc51d0fc02f2980cc08fcd6cfc929ea61ff9d93a (diff)
parent059246d136ed8c24c5e78e6a966bf2dfc945fe4e (diff)
downloadayatana-indicator-power-334e3b3130cbde5a96e6da5323d40418db80f8ef.tar.gz
ayatana-indicator-power-334e3b3130cbde5a96e6da5323d40418db80f8ef.tar.bz2
ayatana-indicator-power-334e3b3130cbde5a96e6da5323d40418db80f8ef.zip
Merge trunk
Diffstat (limited to 'cmake/UseGSettings.cmake')
-rw-r--r--cmake/UseGSettings.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/cmake/UseGSettings.cmake b/cmake/UseGSettings.cmake
new file mode 100644
index 0000000..3b61523
--- /dev/null
+++ b/cmake/UseGSettings.cmake
@@ -0,0 +1,23 @@
+# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them.
+
+macro(add_schema SCHEMA_NAME)
+
+ set(PKG_CONFIG_EXECUTABLE pkg-config)
+ set(GSETTINGS_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/glib-2.0/schemas")
+
+ # Run the validator and error if it fails
+ execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_compile_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process (COMMAND ${_glib_compile_schemas} --dry-run --schema-file=${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if (_schemas_invalid)
+ message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
+ endif (_schemas_invalid)
+
+ # Actually install and recomple schemas
+ message (STATUS "${GSETTINGS_DIR} is the GSettings install dir")
+ install (FILES ${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
+
+ install (CODE "message (STATUS \"Compiling GSettings schemas\")")
+ install (CODE "execute_process (COMMAND ${_glib_compile_schemas} ${GSETTINGS_DIR})")
+endmacro()
+