Merge lp:~codygarver/maya/fix-schema-cmake into lp:~elementary-apps/maya/trunk

Proposed by Cody Garver
Status: Merged
Merged at revision: 67
Proposed branch: lp:~codygarver/maya/fix-schema-cmake
Merge into: lp:~elementary-apps/maya/trunk
Diff against target: 94 lines (+46/-28)
2 files modified
CMakeLists.txt (+4/-28)
cmake/GSettings.cmake (+42/-0)
To merge this branch: bzr merge lp:~codygarver/maya/fix-schema-cmake
Reviewer Review Type Date Requested Status
Cody Garver (community) Approve
Review via email: mp+76318@code.launchpad.net

Description of the change

Correctly installs gschema.xml file

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2011-08-31 20:40:35 +0000
+++ CMakeLists.txt 2011-09-21 02:02:23 +0000
@@ -14,6 +14,8 @@
14set (VERSION "0.2.0")14set (VERSION "0.2.0")
15set (VERSION_INFO "Release")15set (VERSION_INFO "Release")
1616
17list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
18
17#19#
18# Niceties20# Niceties
19#21#
@@ -123,32 +125,6 @@
123#125#
124# GSettings Schema126# GSettings Schema
125#127#
126SET (MAYA_SCHEMAS "org.elementary.Maya.gschema.xml")128include(GSettings)
127129add_schema("org.elementary.Maya.gschema.xml")
128# Have an option to not install the schema into where GLib is
129option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" OFF)
130if (GSETTINGS_LOCALINSTALL)
131 SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
132else (GSETTINGS_LOCALINSTALL)
133 execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
134 SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
135endif (GSETTINGS_LOCALINSTALL)
136
137# Run the validator and error if it fails
138execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
139execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${MAYA_SCHEMAS} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
140
141if (_schemas_invalid)
142 message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
143endif (_schemas_invalid)
144
145# Actually install and recomple schemas
146message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
147install (FILES ${MAYA_SCHEMAS} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
148install (CODE "message (STATUS \"Compiling GSettings schemas\")")
149install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
150
151# Update desktop database
152install (CODE "message (STATUS \"Updating desktop database\")")
153install (CODE "execute_process (COMMAND update-desktop-database)")
154130
155131
=== added file 'cmake/GSettings.cmake'
--- cmake/GSettings.cmake 1970-01-01 00:00:00 +0000
+++ cmake/GSettings.cmake 2011-09-21 02:02:23 +0000
@@ -0,0 +1,42 @@
1# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them.
2
3option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" ON)
4
5option (GSETTINGS_COMPILE "Compile GSettings Schemas after installation" ${GSETTINGS_LOCALINSTALL})
6
7if(GSETTINGS_LOCALINSTALL)
8 message(STATUS "GSettings schemas will be installed locally.")
9endif()
10
11if(GSETTINGS_COMPILE)
12 message(STATUS "GSettings shemas will be compiled.")
13endif()
14
15macro(add_schema SCHEMA_NAME)
16
17 set(PKG_CONFIG_EXECUTABLE pkg-config)
18 # Have an option to not install the schema into where GLib is
19 if (GSETTINGS_LOCALINSTALL)
20 SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
21 else (GSETTINGS_LOCALINSTALL)
22 execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
23 SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
24 endif (GSETTINGS_LOCALINSTALL)
25
26 # Run the validator and error if it fails
27 execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
28 execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
29
30 if (_schemas_invalid)
31 message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
32 endif (_schemas_invalid)
33
34 # Actually install and recomple schemas
35 message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
36 install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
37
38 if (GSETTINGS_COMPILE)
39 install (CODE "message (STATUS \"Compiling GSettings schemas\")")
40 install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
41 endif ()
42endmacro()

Subscribers

People subscribed via source and target branches