aboutsummaryrefslogtreecommitdiff
path: root/cmake/UseGSettings.cmake
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-10-30 23:49:58 +0000
committerTarmac <Unknown>2013-10-30 23:49:58 +0000
commitbbc781d9e2afe500d9a5d09335f0954f25269be6 (patch)
tree87ad870ab7d39777686e4f9661bcaa4ba41b5e1d /cmake/UseGSettings.cmake
parent19ba64b479fd14d5192f0ec3dcc37fe33bde238b (diff)
parent13cc891202d3721fc157c827ed1141ee6221ccbd (diff)
downloadayatana-indicator-datetime-bbc781d9e2afe500d9a5d09335f0954f25269be6.tar.gz
ayatana-indicator-datetime-bbc781d9e2afe500d9a5d09335f0954f25269be6.tar.bz2
ayatana-indicator-datetime-bbc781d9e2afe500d9a5d09335f0954f25269be6.zip
Switch the build system to cmake. Fixes: https://bugs.launchpad.net/bugs/1237509.
Approved by Ted Gould, PS Jenkins bot.
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()
+