summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: d42fd8a22273d8576d5a97d346f81baaacd96c06 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#################################################
#
#  (C) 2012 Golubev Alexander
#  fatzer2 (AT) gmail.com
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

cmake_minimum_required( VERSION 2.8.12 )


##### general package setup #####################

project( tdeutils )

set( PACKAGE tdeutils )
set( VERSION R14.0.11 )


##### include essential cmake modules ###########

include( FindPkgConfig )
include( CheckIncludeFile )
include( CheckIncludeFiles )
include( CheckLibraryExists )
include( CheckSymbolExists )
include( CheckFunctionExists )
include( CheckCSourceCompiles )
include( CheckCXXSourceCompiles )
include( CheckTypeSize )


##### include our cmake modules #################

set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )


##### setup install paths #######################

include( TDESetupPaths )
tde_setup_paths( )


##### optional stuff ############################

option( WITH_DPMS "Enable Display Power Management Signaling support" OFF )
option( WITH_XSCREENSAVER "Enable xscreensaver support" OFF )
option( WITH_ASUS "Enable asus laptop support" OFF )
option( WITH_POWERBOOK "Enable powerbook laptop support" OFF )
option( WITH_POWERBOOK2 "Enable powerbook2 laptop support" OFF )
option( WITH_VAIO "Enable vaio laptop support" OFF )
option( WITH_THINKPAD "Enable thinkpad laptop support" OFF )
option( WITH_I8K "Enable dell laptop support" OFF )
option( WITH_SNMP "Enable SNMP support" OFF )
option( WITH_SENSORS "Enable lm_sensors support" OFF )
option( WITH_XMMS "Enable xmms support" OFF )
option( WITH_TDENEWSTUFF "Enable tdenewstuff support" OFF )

# option( WITH_NV "Enable nv support" OFF )


##### options comments ##########################

# WITH_DPMS         affects klaptopdaemon
# WITH_DPMS         description enables the klaptopdaemon to take into account
#                               the state of DPMS X extention to determine is
#                               there any user activity.
# WITH_DPMS         requires libXext to build
# WITH_XSCREENSAVER affects klaptopdaemon
# WITH_XSCREENSAVER description this makes klaptopdaemon not to register user
#                               events when screensaver is disabled.
# WITH_ASUS         affects kmilo 
# WITH_POWERBOOK    affects kmilo
# WITH_POWERBOOK    requires pbbuttonsd
# WITH_POWERBOOK2   affects kmilo
# WITH_POWERBOOK2   requires pbbuttonsd
# WITH_VAIO         affects kmilo
# WITH_THINKPAD     affects kmilo
# WITH_I8K          affects kmilo ksim
# WITH_SNMP         affects ksim
# WITH_SENSORS      affects ksim
# WITH_XMMS         affects superkaramba
# WITH_XMMS         description enables supercaramba applets to gain 
#                               information about now playing track etc.
# WITH_TDENEWSTUFF  affects superkaramba
# WITH_TDENEWSTUFF  description enables support for downloadable content
#                               from OpenDesktop.org.
# FIXME: test if WITH_TDENEWSTUFF works in trinity or not

# NOTE: In addition to affects DPMS and XScreenSaver backend options for 
#       klaptopdaemon there is some XIdle code but it wasn't compleatly 
#       implemented and disabled permanently.

# NOTE: WITH_<laptop> options controls what kamilo modules will be build

# NOTE: WITH_{SENSORS,SNMP,I8K} options for ksim determin which ksim modules
#       will be build.

# NOTE: WITH_XMMS doesn't requires xmms2 palayer to be compiled.


##### user requested modules ####################

option( BUILD_ALL "Build all" OFF )
option( BUILD_DOC "Build documentation" ${BUILD_ALL} )
option( BUILD_ARK "Build ark" ${BUILD_ALL} )
option( BUILD_CHARSELECTAPPLET "Build charselectapplet" ${BUILD_ALL} )
option( BUILD_KCALC "Build kcalc" ${BUILD_ALL} )
option( BUILD_KCHARSELECT "Build kcharselect" ${BUILD_ALL} )
option( BUILD_TDELIRC "Build tdelirc" ${BUILD_ALL} )
option( BUILD_TDESSH "Build tdessh" ${BUILD_ALL} )
option( BUILD_KDF "Build kdf" ${BUILD_ALL} )
option( BUILD_KEDIT "Build kedit" ${BUILD_ALL} )
option( BUILD_KFLOPPY "Build kfloppy" ${BUILD_ALL} )
option( BUILD_KGPG "Build kgpg" ${BUILD_ALL} )
option( BUILD_KHEXEDIT "Build khexedit" ${BUILD_ALL} )
option( BUILD_KJOTS "Build kjots" ${BUILD_ALL} )
option( BUILD_KLAPTOPDAEMON "Build klaptopdaemon" ${BUILD_ALL} )
option( BUILD_KMILO "Build kmilo" ${BUILD_ALL} )
option( BUILD_KREGEXPEDITOR "Build kregexpeditor" ${BUILD_ALL} )
option( BUILD_KSIM "Build ksim" ${BUILD_ALL} )
option( BUILD_KTIMER "Build ktimer" ${BUILD_ALL} )
option( BUILD_TDEWALLET "Build tdewallet" ${BUILD_ALL} )

option( BUILD_SUPERKARAMBA "Build superkaramba" ${BUILD_ALL} )

##### add apidox targets ############

if( "${CMAKE_VERSION}" VERSION_LESS "3.1" )
  set( CMAKE_ENV "env" )
else()
  set( CMAKE_ENV "${CMAKE_COMMAND};-E;env" )
endif()

add_custom_target( apidox
  COMMAND ${CMAKE_ENV}
    "QTDOCDIR=/usr/share/tqt3/doc/html"
    "DOXDATA=${HTML_INSTALL_DIR}/en/common"
    ${CMAKE_SOURCE_DIR}/admin/doxygen.sh
    --no-modulename
    ${CMAKE_SOURCE_DIR}
  COMMAND
    find ${CMAKE_BINARY_DIR}/apidocs -name '*.html' |
    xargs -r sed -i 's|${CMAKE_BINARY_DIR}/apidocs|${HTML_INSTALL_DIR}/en/${PROJECT_NAME}-apidocs|g'
  COMMAND
    find ${CMAKE_BINARY_DIR}/apidocs -name '*.tag' |
    xargs -r sed -i 's|${CMAKE_SOURCE_DIR}/|${PROJECT_NAME}/|g'
  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)

add_custom_target( install-apidox
  COMMAND ${CMAKE_COMMAND} -E echo Apidox installed in ${HTML_INSTALL_DIR}/en/${PROJECT_NAME}-apidocs
)

install( CODE "
  if( EXISTS ${CMAKE_BINARY_DIR}/apidocs )
    file(
      INSTALL ${CMAKE_BINARY_DIR}/apidocs/
      DESTINATION ${HTML_INSTALL_DIR}/en/${PROJECT_NAME}-apidocs
      PATTERN doxygen_sqlite3.db EXCLUDE
      PATTERN installdox-slow EXCLUDE
    )
  endif()"
)


##### configure checks ##########################

include( ConfigureChecks.cmake )


###### global compiler settings #################

add_definitions(
  -DHAVE_CONFIG_H
)

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )


##### tdeutils directories ######################

tde_conditional_add_subdirectory( BUILD_ARK ark )
tde_conditional_add_subdirectory( BUILD_DOC doc )
tde_conditional_add_subdirectory( BUILD_CHARSELECTAPPLET charselectapplet )
tde_conditional_add_subdirectory( BUILD_KCALC kcalc )
tde_conditional_add_subdirectory( BUILD_KCHARSELECT kcharselect )
tde_conditional_add_subdirectory( BUILD_TDELIRC tdelirc )
tde_conditional_add_subdirectory( BUILD_TDESSH tdessh )
tde_conditional_add_subdirectory( BUILD_KDF kdf )
tde_conditional_add_subdirectory( BUILD_KEDIT kedit )
tde_conditional_add_subdirectory( BUILD_KFLOPPY kfloppy )
tde_conditional_add_subdirectory( BUILD_KGPG kgpg )
tde_conditional_add_subdirectory( BUILD_KHEXEDIT khexedit )
tde_conditional_add_subdirectory( BUILD_KJOTS kjots )
tde_conditional_add_subdirectory( BUILD_KLAPTOPDAEMON klaptopdaemon )
tde_conditional_add_subdirectory( BUILD_KMILO kmilo )
tde_conditional_add_subdirectory( BUILD_KREGEXPEDITOR kregexpeditor )
tde_conditional_add_subdirectory( BUILD_KSIM ksim )
tde_conditional_add_subdirectory( BUILD_KTIMER ktimer )
tde_conditional_add_subdirectory( BUILD_TDEWALLET tdewallet )
tde_conditional_add_subdirectory( BUILD_SUPERKARAMBA superkaramba )


##### write configure files #####################

configure_file( config.h.cmake config.h @ONLY )