summaryrefslogtreecommitdiffstats
path: root/cmake_admin/FindKDECONFIG.cmake
blob: fd640ba7c113905231ff13dc93349775460f1cdf (plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Rosegarden
# A MIDI and audio sequencer and musical notation editor.
#
# This program is Copyright 2000-2008
#     Guillaume Laurent   <[email protected]>,
#     Chris Cannam        <[email protected]>,
#     Richard Bown        <[email protected]>
#
# The moral rights of Guillaume Laurent, Chris Cannam, and Richard
# Bown to claim authorship of this work have been asserted.
#
# This file is Copyright 2006-2008
#     Pedro Lopez-Cabanillas <[email protected]>
#
# Other copyrights also apply to some parts of this work.  Please
# see the AUTHORS file and individual file headers for details.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.  See the file
# COPYING included with this distribution for more information.
# Find the tde-config program and retrieve the install dirs

# Variables:
#       HAVE_KDECONFIG
#       KDECONFIG_EXECUTABLE
#       KDE3PREFIX
#       KDE3HTMLDIR
#       KDE3DATADIR
#       KDE3ICONDIR
#       KDE3MIMEDIR
#       KDE3MENUDIR
#       KDE3EXECDIR
#       KDE3L18NDIR

IF(KDECONFIG_EXECUTABLE)
    SET(HAVE_KDECONFIG TRUE)
ELSE(KDECONFIG_EXECUTABLE)
    FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES tde-config PATHS
        $ENV{TDEDIR}/bin
        /opt/trinity/bin
        /opt/kde/bin
        NO_DEFAULT_PATH
    )
    FIND_PROGRAM(KDECONFIG_EXECUTABLE tde-config)
ENDIF(KDECONFIG_EXECUTABLE)

IF(NOT KDE3PREFIX)
    EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --version
                    OUTPUT_VARIABLE kde_config_version )
    STRING(REGEX MATCH "KDE: .\\." kde_version ${kde_config_version})
    IF (${kde_version} MATCHES "KDE: 3\\.")
        EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --prefix
                	OUTPUT_VARIABLE tdedir )
        STRING(REGEX REPLACE "\n" "" KDE3PREFIX "${tdedir}")
    ENDIF (${kde_version} MATCHES "KDE: 3\\.")
ENDIF(NOT KDE3PREFIX)

IF(NOT KDE3HTMLDIR)
    EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install html
        OUTPUT_VARIABLE _htmlinstalldir)
    STRING(REGEX REPLACE "\n" "" _htmlinstalldir "${_htmlinstalldir}")
    STRING(REPLACE "${KDE3PREFIX}/" "" KDE3HTMLDIR "${_htmlinstalldir}")
    MESSAGE(STATUS "KDE3HTMLDIR : ${KDE3HTMLDIR}")
ENDIF(NOT KDE3HTMLDIR)

IF(NOT KDE3DATADIR)
    EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install data
        OUTPUT_VARIABLE _datainstalldir)
    STRING(REGEX REPLACE "\n" "" _datainstalldir "${_datainstalldir}")
    STRING(REPLACE "${KDE3PREFIX}/" "" KDE3DATADIR "${_datainstalldir}")
    MESSAGE(STATUS "KDE3DATADIR : ${KDE3DATADIR}")
ENDIF(NOT KDE3DATADIR)

IF(NOT KDE3ICONDIR)
    EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install icon
        OUTPUT_VARIABLE _iconinstalldir)
    STRING(REGEX REPLACE "\n" "" _iconinstalldir "${_iconinstalldir}")
    STRING(REPLACE "${KDE3PREFIX}/" "" KDE3ICONDIR "${_iconinstalldir}")
    MESSAGE(STATUS "KDE3ICONDIR : ${KDE3ICONDIR}")
ENDIF(NOT KDE3ICONDIR)

IF(NOT KDE3MIMEDIR)
    EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install mime
        OUTPUT_VARIABLE _mimeinstalldir)
    STRING(REGEX REPLACE "\n" "" _mimeinstalldir "${_mimeinstalldir}")
    STRING(REPLACE "${KDE3PREFIX}/" "" KDE3MIMEDIR "${_mimeinstalldir}")
    MESSAGE(STATUS "KDE3MIMEDIR : ${KDE3MIMEDIR}")
ENDIF(NOT KDE3MIMEDIR)

IF(NOT KDE3MENUDIR)
    EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install xdgdata-apps
        OUTPUT_VARIABLE _menuinstalldir)
    STRING(REGEX REPLACE "\n" "" _menuinstalldir "${_menuinstalldir}")
    STRING(REPLACE "${KDE3PREFIX}/" "" KDE3MENUDIR "${_menuinstalldir}")
    MESSAGE(STATUS "KDE3MENUDIR : ${KDE3MENUDIR}")
ENDIF(NOT KDE3MENUDIR)

IF(NOT KDE3L18NDIR)
    EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install locale
        OUTPUT_VARIABLE _l18ninstalldir)
    STRING(REGEX REPLACE "\n" "" _l18ninstalldir "${_l18ninstalldir}")
    STRING(REPLACE "${KDE3PREFIX}/" "" KDE3L18NDIR "${_l18ninstalldir}")
    MESSAGE(STATUS "KDE3L18NDIR : ${KDE3L18NDIR}")
ENDIF(NOT KDE3L18NDIR)

IF(NOT KDE3EXECDIR)
    EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install exe
        OUTPUT_VARIABLE _execinstalldir)
    STRING(REGEX REPLACE "\n" "" _execinstalldir "${_execinstalldir}")
    STRING(REPLACE "${KDE3PREFIX}/" "" KDE3EXECDIR "${_execinstalldir}")
    MESSAGE(STATUS "KDE3EXECDIR : ${KDE3EXECDIR}")
ENDIF(NOT KDE3EXECDIR)