File: ManageGConf.cmake

package info (click to toggle)
ibus-table-chinese 1.8.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 29,812 kB
  • sloc: sh: 106; makefile: 11
file content (67 lines) | stat: -rw-r--r-- 2,276 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# - GConf relative targets such as install/unstall schemas.
# This module finds gconftool-2 or gconftool for GConf manipulation.
#
# Reads following variables:
# GCONF_SCHEMAS_FILE: Schema file.
#         Default: "${PROJECT_NAME}.schemas"
#
# GCONF_SCHEMAS_INSTALLED_DIR: Direct of installed schemas files.
#         Default: "${SYSCONF_INSTALL_DIR}/gconf/schemas"
#
# GCONF_CONFIG_SOURCE: configuration source.
#         Default: "" (Use the system default)
#
# Defines following targets:
#   install_schemas: install schemas
#
#   uninstall_schemas: uninstall schemas
#

IF(NOT DEFINED _MANAGE_GCONF_CMAKE_)
    FIND_PROGRAM(GCONFTOOL_CMD NAMES gconftool-2 gconftool)

    IF(${GCONFTOOL_CMD} STREQUAL "GCONFTOOL_CMD-NOTFOUND")
	MESSAGE(FATAL_ERROR "gconftool and gconftool-2 are not found, please install GConf or GConf2.")
    ENDIF()

    IF (NOT DEFINED GCONF_SCHEMAS_FILE)
	SET(GCONF_SCHEMAS_FILE  "${PROJECT_NAME}.schemas")
    ENDIF(NOT DEFINED GCONF_SCHEMAS_FILE)

    GET_FILENAME_COMPONENT(_gconf_schemas_basename ${GCONF_SCHEMAS_FILE} NAME)

    IF (NOT DEFINED GCONF_SCHEMAS_INSTALLED_DIR)
	IF(SYSCONF_INSTALL_DIR)
	    SET(GCONF_SCHEMAS_INSTALLED_DIR  "${SYSCONF_INSTALL_DIR}/gconf/schemas")
	ELSE(SYSCONF_INSTALL_DIR)
	    SET(GCONF_SCHEMAS_INSTALLED_DIR  "${SYSCONF_DIR}/gconf/schemas")
	ENDIF(SYSCONF_INSTALL_DIR)
    ENDIF(NOT DEFINED GCONF_SCHEMAS_INSTALLED_DIR)

    IF (NOT DEFINED GCONF_CONFIG_SOURCE)
	SET(GCONF_CONFIG_SOURCE "")
    ENDIF(NOT DEFINED GCONF_CONFIG_SOURCE)
    SET(ENV{GCONF_CONFIG_SOURCE} ${GCONF_CONFIG_SOURCE})


    ADD_CUSTOM_TARGET(uninstall_schemas
	COMMAND GCONF_CONFIG_SOURCE=${GCONF_CONFIG_SOURCE}
	${GCONFTOOL_CMD} --makefile-uninstall-rule
	${GCONF_SCHEMAS_INSTALLED_DIR}/${_gconf_schemas_basename}
	COMMENT "Uninstalling schemas"
	)

    ADD_CUSTOM_TARGET(install_schemas
	COMMAND cmake -E copy ${GCONF_SCHEMAS_FILE} ${GCONF_SCHEMAS_INSTALLED_DIR}/${_gconf_schemas_basename}
	COMMAND GCONF_CONFIG_SOURCE=${GCONF_CONFIG_SOURCE}
	${GCONFTOOL_CMD} --makefile-install-rule
	${GCONF_SCHEMAS_INSTALLED_DIR}/${_gconf_schemas_basename}
	DEPENDS ${GCONF_SCHEMAS_FILE}
	COMMENT "Installing schemas"
	)

    INSTALL(FILES ${GCONF_SCHEMAS_FILE}
	DESTINATION "${GCONF_SCHEMAS_INSTALLED_DIR}")
ENDIF(NOT DEFINED _MANAGE_GCONF_CMAKE_)