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
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2011-08-31 20:40:35 +0000
3+++ CMakeLists.txt 2011-09-21 02:02:23 +0000
4@@ -14,6 +14,8 @@
5 set (VERSION "0.2.0")
6 set (VERSION_INFO "Release")
7
8+list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
9+
10 #
11 # Niceties
12 #
13@@ -123,32 +125,6 @@
14 #
15 # GSettings Schema
16 #
17-SET (MAYA_SCHEMAS "org.elementary.Maya.gschema.xml")
18-
19-# Have an option to not install the schema into where GLib is
20-option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" OFF)
21-if (GSETTINGS_LOCALINSTALL)
22- SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
23-else (GSETTINGS_LOCALINSTALL)
24- execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
25- SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
26-endif (GSETTINGS_LOCALINSTALL)
27-
28-# Run the validator and error if it fails
29-execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
30-execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${MAYA_SCHEMAS} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
31-
32-if (_schemas_invalid)
33- message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
34-endif (_schemas_invalid)
35-
36-# Actually install and recomple schemas
37-message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
38-install (FILES ${MAYA_SCHEMAS} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
39-install (CODE "message (STATUS \"Compiling GSettings schemas\")")
40-install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
41-
42-# Update desktop database
43-install (CODE "message (STATUS \"Updating desktop database\")")
44-install (CODE "execute_process (COMMAND update-desktop-database)")
45+include(GSettings)
46+add_schema("org.elementary.Maya.gschema.xml")
47
48
49=== added file 'cmake/GSettings.cmake'
50--- cmake/GSettings.cmake 1970-01-01 00:00:00 +0000
51+++ cmake/GSettings.cmake 2011-09-21 02:02:23 +0000
52@@ -0,0 +1,42 @@
53+# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them.
54+
55+option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" ON)
56+
57+option (GSETTINGS_COMPILE "Compile GSettings Schemas after installation" ${GSETTINGS_LOCALINSTALL})
58+
59+if(GSETTINGS_LOCALINSTALL)
60+ message(STATUS "GSettings schemas will be installed locally.")
61+endif()
62+
63+if(GSETTINGS_COMPILE)
64+ message(STATUS "GSettings shemas will be compiled.")
65+endif()
66+
67+macro(add_schema SCHEMA_NAME)
68+
69+ set(PKG_CONFIG_EXECUTABLE pkg-config)
70+ # Have an option to not install the schema into where GLib is
71+ if (GSETTINGS_LOCALINSTALL)
72+ SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
73+ else (GSETTINGS_LOCALINSTALL)
74+ execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
75+ SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
76+ endif (GSETTINGS_LOCALINSTALL)
77+
78+ # Run the validator and error if it fails
79+ execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
80+ execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
81+
82+ if (_schemas_invalid)
83+ message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
84+ endif (_schemas_invalid)
85+
86+ # Actually install and recomple schemas
87+ message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
88+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
89+
90+ if (GSETTINGS_COMPILE)
91+ install (CODE "message (STATUS \"Compiling GSettings schemas\")")
92+ install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
93+ endif ()
94+endmacro()

Subscribers

People subscribed via source and target branches