summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: e7ab1d23cdef371a98f807d39f5bc33b559b9290 (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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
#################################################
#
#  (C) 2010-2012 Serghei Amelian
#  serghei (DOT) amelian (AT) gmail.com
#
#  (C) 2014 Timothy Pearson
#  kb9vqf (AT) pearsoncomputing (DOT) net
#
#  Improvements and feedback are welcome
#
#################################################

cmake_minimum_required( VERSION 3.5 )


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

project( tdebase )

set( PACKAGE tdebase )


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

include( FindPkgConfig )
include( CheckIncludeFile )
include( CheckIncludeFiles )
include( CheckCSourceRuns )
include( CheckCXXSourceRuns )
include( CheckCXXSourceCompiles )
include( CheckLibraryExists )
include( CheckFunctionExists )
include( CheckSymbolExists )
include( CheckStructHasMember )
include( CheckTypeSize )


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

include( TDEMacros )


##### set version number ########################

tde_set_project_version( )


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

include( TDESetupPaths )
tde_setup_paths( )


##### 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}
    "TQTDOCDIR=/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()"
)


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

option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
option( WITH_SASL "Enable SASL support" ${WITH_ALL_OPTIONS} )
option( WITH_LDAP "Enable LDAP support" ${WITH_ALL_OPTIONS} )
option( WITH_SAMBA "Enable SAMBA support" ${WITH_ALL_OPTIONS} )
option( WITH_SFTP "Enable SFTP support" ${WITH_ALL_OPTIONS} )
option( WITH_OPENEXR "Enable openexr support" ${WITH_ALL_OPTIONS} )
option( WITH_XCOMPOSITE "Enable xcomposite support" ${WITH_ALL_OPTIONS} )
option( WITH_XCURSOR "Enable xcursor support" ${WITH_ALL_OPTIONS} )
option( WITH_XFIXES "Enable xfixes support" ${WITH_ALL_OPTIONS} )
option( WITH_XRANDR "Enable xrandr support" ${WITH_ALL_OPTIONS} )
option( WITH_XRENDER "Enable xrender support" ${WITH_ALL_OPTIONS} )
option( WITH_LIBCONFIG "Enable libconfig support" ${WITH_ALL_OPTIONS} )
option( WITH_PCRE "Enable pcre regex support" ON )
option( WITH_XTEST "Enable xtest support" ${WITH_ALL_OPTIONS} )
option( WITH_OPENGL "Enable openGL support" ${WITH_ALL_OPTIONS} )
option( WITH_XSCREENSAVER "Enable xscreensaver support" ${WITH_ALL_OPTIONS} )
option( WITH_LIBART "Enable libart support (for SVG icons and wallpapers)" ${WITH_ALL_OPTIONS} )
option( WITH_LIBUSB "Enable control of some mouse models through libusb" ${WITH_ALL_OPTIONS} )
option( WITH_LIBRAW1394 "Enable visualization of ieee1394 devices through libraw1394" ${WITH_ALL_OPTIONS} )
option( WITH_SUDO_TDESU_BACKEND "Use sudo as backend for tdesu (default is su)" OFF )
option( WITH_SUDO_KONSOLE_SUPER_USER_COMMAND "Use sudo when launching Konsole super user sessions (default is su)" OFF )
option( WITH_PAM "tdm should use PAM" ${WITH_ALL_OPTIONS} )
option( WITH_SHADOW "tdm should use shadow passwords" ${WITH_ALL_OPTIONS} )
option( WITH_XDMCP "xdmcp support for tdm" ${WITH_ALL_OPTIONS} )
option( WITH_XINERAMA "Enable xinerama extension support" ${WITH_ALL_OPTIONS} )
option( WITH_ARTS "Enable aRts support" ${WITH_ALL_OPTIONS} )
option( WITH_I8K "Enable Dell laptop support (ksysguard)" ${WITH_ALL_OPTIONS} )
option( WITH_SENSORS "Enable lm_sensors support (ksysguard)" ${WITH_ALL_OPTIONS} )
option( WITH_TDEHWLIB "Enable TDE hardware library support" ${WITH_ALL_OPTIONS} )
option( WITH_UPOWER "Enable UPOWER support" ${WITH_ALL_OPTIONS} )
option( WITH_ELFICON "Enable ELF embedded metadata support" ${WITH_ALL_OPTIONS} )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )

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

# WITH_SASL         affects tdeioslaves(tdeio_ldap tdeio_smtp tdeio_pop3)
# WITH_LDAP         affects tdeioslaves(tdeio_ldap)
# WITH_SAMBA        affects tdeioslaves(tdeio_samba) kcontrol
# WITH_SFTP         affects tdeioslaves(tdeio_sftp)
# WITH_OPENEXR      affects tdeioslaves(thumbnail)
# WITH_XCOMPOSITE   affects twin kicker(taskmanager) tdm
# WITH_XCURSOR      affects tdeioslaves(thumbnail), kcontrol(input), kdesktop
# WITH_XFIXES       affects twin klipper kicker(taskmanager)
# WITH_XRANDR       affects tdm, kcontrol(displayconfig randr iccconfig)
# WITH_XRENDER      affects twin konsole kicker(taskmanager) kdesktop
#                           kcontrol(style)
# WITH_XTEST        desription adds some hotkey functonality. Its functionality
#                              replaced by xkb nearly everywhere except the
#                              mouse gestures. Also it used as a fallback if
#                              xkb initialization fails.
# WITH_XTEST        affects tdm kxkb khotkeys
# WITH_XSCREENSAVER affects kdesktop
# WITH_LIBART       affects tdm kcontrol(icons background)
# WITH_LIBUSB       affects kcontrol(input)
# WITH_XDMCP        affects tdm
# WITH_XINERAMA     affects ksplashml twin/compton-tde
# WITH_ARTS         affects libkonq khotkeys
# WITH_I8K          affects ksysguard
# WITH_SENSORS      affects ksysguard
# WITH_TDEHWLIB     affects tdeioslaves(media)
# WITH_LIBRAW1394   affects kcontrol(view1394)
# WITH_PAM          affects tdm kdesktop kcheckpass
# WITH_SHADOW       affects tdm kcheckpass
# WITH_UPOWER       affects ksmserver
# WITH_LIBCONFIG    affects twin/compot-tde
# WITH_PCRE         affects twin/compot-tde
# WITH_SUDO_TDESU_BACKEND affects tdesu
# WITH_SUDO_KONSOLE_SUPER_USER_COMMAND affects launching Konsole super user sessions

# NOTE: WITH_SHADOW and WITH_PAM shouldn't be set concurrently
#       WITH_PAM will override WITH_SHADOW
# NOTE: if WITH_XCOMPOSITE=ON then the following options are also required:
#       WITH_XRENDER=ON
#       WITH_XFIXES=ON

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

option( BUILD_ALL "Build all" OFF )
option( BUILD_TDEINIT "Build tdeinit" ${BUILD_ALL} )
option( BUILD_L10N "Build l10n" ${BUILD_ALL} )
option( BUILD_PICS "Build pics" ${BUILD_ALL} )
option( BUILD_APPLNK "Build applnk" ${BUILD_ALL} )
option( BUILD_DOC "Build doc" ${BUILD_ALL} )
option( BUILD_LIBKONQ "Build libkonq" ${BUILD_ALL} )
option( BUILD_KCMINIT "Build kcminit" ${BUILD_ALL} )
option( BUILD_KCONTROL "Build kcontrol" ${BUILD_ALL} )
option( BUILD_TWIN "Build twin" ${BUILD_ALL} )
option( BUILD_KATE "Build kate" ${BUILD_ALL} )
option( BUILD_KONQUEROR "Build konqueror" ${BUILD_ALL} )
option( BUILD_TDEIOSLAVES "Build tdeioslaves" ${BUILD_ALL} )
option( BUILD_KICKER "Build kicker" ${BUILD_ALL} )
option( BUILD_KDESKTOP "Build kdesktop" ${BUILD_ALL} )
option( BUILD_KONSOLE "Build konsole" ${BUILD_ALL} )
option( BUILD_KLIPPER "Build klipper" ${BUILD_ALL} )
option( BUILD_KMENUEDIT "Build kmenuedit" ${BUILD_ALL} )
option( BUILD_TDEPRINT "Build tdeprint" ${BUILD_ALL} )
option( BUILD_KPERSONALIZER "Build kpersonalizer" ${BUILD_ALL} )
option( BUILD_TDEPASSWD "Build tdepasswd" ${BUILD_ALL} )
option( BUILD_KTIP "Build ktip" ${BUILD_ALL} )
option( BUILD_TDEEJECT "Build tdeeject" ${BUILD_ALL} )
option( BUILD_KDIALOG "Build kdialog" ${BUILD_ALL} )
option( BUILD_KREADCONFIG "Build kreadconfig" ${BUILD_ALL} )
option( BUILD_TDESU "Build tdesu" ${BUILD_ALL} )
option( BUILD_TDM "Build tdm" ${BUILD_ALL} )
option( BUILD_TDM_SYSTEMD_UNIT_FILE "Build tdm service file for systemd" OFF )
option( BUILD_KSMSERVER "Build ksmserver" ${BUILD_ALL} )
option( BUILD_KSPLASHML "Build ksplashml" ${BUILD_ALL} )
option( BUILD_STARTTDE "Build starttde" ${BUILD_ALL} )
option( BUILD_KFIND "Build kfind" ${BUILD_ALL} )
option( BUILD_DRKONQI "Build drkonqi" ${BUILD_ALL} )
option( BUILD_KDCOP "Build kdcop" ${BUILD_ALL} )
option( BUILD_TDEDEBUGDIALOG "Build tdedebugdialog" ${BUILD_ALL} )
option( BUILD_KNETATTACH "Build knetattach" ${BUILD_ALL} )
option( BUILD_KPAGER "Build kpager" ${BUILD_ALL} )
option( BUILD_KAPPFINDER "Build kappfinder" ${BUILD_ALL} )
option( BUILD_KCHECKPASS "Build kcheckpass" ${BUILD_ALL} )
option( BUILD_KHELPCENTER "Build khelpcenter" ${BUILD_ALL} )
option( BUILD_KHOTKEYS "Build khotkeys" ${BUILD_ALL} )
option( BUILD_TDESCREENSAVER "Build tdescreensaver" ${BUILD_ALL} )
option( BUILD_KSTART "Build kstart" ${BUILD_ALL} )
option( BUILD_KSYSTRAYCMD "Build ksystraycmd" ${BUILD_ALL} )
option( BUILD_NSPLUGINS "Build nsplugins"  ${BUILD_ALL} )
option( BUILD_KSYSGUARD "Build ksysguard"  ${BUILD_ALL} )
option( BUILD_KXKB "Build kxkb"  ${BUILD_ALL} )
option( BUILD_TSAK "Build tsak"  ${BUILD_ALL} )
option( BUILD_TDEKBDLEDSYNC "Build tdekbdledsync"  ${BUILD_ALL} )
option( BUILD_KROOTBACKING "Build krootbacking"  ${BUILD_ALL} )
option( BUILD_TQT3INTEGRATION "Build tqt3integration"  ${BUILD_ALL} )
option( BUILD_CRASHTEST "Build crash test program"  ${BUILD_ALL} )
option( BUILD_PROFILE_SHUTDOWN "Build ksmserver shutdown debugging timing markers"  OFF )


##### set PKG_CONFIG_PATH #######################

set( ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH}:${LIB_INSTALL_DIR}/pkgconfig" )


##### 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" )

check_type_size( "long long" LONG_LONG )


##### tdebase directories #######################

add_subdirectory( tdmlib )
add_subdirectory( kcontrol )

tde_conditional_add_subdirectory( BUILD_TDEINIT tdeinit )
tde_conditional_add_subdirectory( BUILD_L10N l10n )
tde_conditional_add_subdirectory( BUILD_PICS pics )
tde_conditional_add_subdirectory( BUILD_APPLNK applnk )
tde_conditional_add_project_docs( BUILD_DOC )
tde_conditional_add_subdirectory( BUILD_LIBKONQ libkonq )
tde_conditional_add_subdirectory( BUILD_KCMINIT kcminit )
tde_conditional_add_subdirectory( BUILD_TWIN twin )
tde_conditional_add_subdirectory( BUILD_KATE kate )
tde_conditional_add_subdirectory( BUILD_KONQUEROR konqueror )
tde_conditional_add_subdirectory( BUILD_TDEIOSLAVES tdeioslave )
tde_conditional_add_subdirectory( BUILD_KICKER kicker )
tde_conditional_add_subdirectory( BUILD_KDESKTOP kdesktop )
tde_conditional_add_subdirectory( BUILD_KONSOLE konsole )
tde_conditional_add_subdirectory( BUILD_KLIPPER klipper )
tde_conditional_add_subdirectory( BUILD_KMENUEDIT kmenuedit )
tde_conditional_add_subdirectory( BUILD_TDEPRINT tdeprint )
tde_conditional_add_subdirectory( BUILD_KPERSONALIZER kpersonalizer )
tde_conditional_add_subdirectory( BUILD_TDEPASSWD tdepasswd )
tde_conditional_add_subdirectory( BUILD_KTIP ktip )
tde_conditional_add_subdirectory( BUILD_TDEEJECT tdeeject )
tde_conditional_add_subdirectory( BUILD_KDIALOG kdialog )
tde_conditional_add_subdirectory( BUILD_KREADCONFIG kreadconfig )
tde_conditional_add_subdirectory( BUILD_TDESU tdesu )
tde_conditional_add_subdirectory( BUILD_TDM tdm )
tde_conditional_add_subdirectory( BUILD_KSMSERVER ksmserver )
tde_conditional_add_subdirectory( BUILD_KSPLASHML ksplashml )
tde_conditional_add_subdirectory( BUILD_KFIND kfind )
tde_conditional_add_subdirectory( BUILD_DRKONQI drkonqi )
tde_conditional_add_subdirectory( BUILD_KDCOP kdcop )
tde_conditional_add_subdirectory( BUILD_TDEDEBUGDIALOG tdedebugdialog )
tde_conditional_add_subdirectory( BUILD_KNETATTACH knetattach )
tde_conditional_add_subdirectory( BUILD_KPAGER kpager )
tde_conditional_add_subdirectory( BUILD_KAPPFINDER kappfinder )
tde_conditional_add_subdirectory( BUILD_KCHECKPASS kcheckpass )
tde_conditional_add_subdirectory( BUILD_KHELPCENTER khelpcenter )
tde_conditional_add_subdirectory( BUILD_KHOTKEYS khotkeys )
tde_conditional_add_subdirectory( BUILD_TDESCREENSAVER tdescreensaver )
tde_conditional_add_subdirectory( BUILD_KSTART kstart )
tde_conditional_add_subdirectory( BUILD_KSYSTRAYCMD ksystraycmd )
tde_conditional_add_subdirectory( BUILD_NSPLUGINS nsplugins )
tde_conditional_add_subdirectory( BUILD_KSYSGUARD ksysguard )
tde_conditional_add_subdirectory( BUILD_KXKB kxkb )
tde_conditional_add_subdirectory( BUILD_TSAK tsak )
tde_conditional_add_subdirectory( BUILD_TDEKBDLEDSYNC tdekbdledsync )
tde_conditional_add_subdirectory( BUILD_KROOTBACKING krootbacking )
tde_conditional_add_subdirectory( BUILD_TQT3INTEGRATION tqt3integration )

##### install starttde & related stuff ##########

if( BUILD_STARTTDE )
  install( PROGRAMS starttde migratekde3 r14-xdg-update tde_release_notes tde_show_license_info
           DESTINATION ${BIN_INSTALL_DIR} )
endif()


##### Checks for a distribution-specific 1st menu item, generally a control center
if(EXISTS "/usr/share/applications/YaST.desktop")
  set( KICKOFF_DIST_CONFIG_SHORTCUT1 "/usr/share/applications/YaST.desktop" )
endif()
if(EXISTS "/usr/share/applications/mageia-drakconf.desktop")
  set( KICKOFF_DIST_CONFIG_SHORTCUT1 "/usr/share/applications/mageia-drakconf.desktop" )
endif()
if(EXISTS "/usr/share/applications/pclinuxos-drakconf.desktop")
  set( KICKOFF_DIST_CONFIG_SHORTCUT1 "/usr/share/applications/pclinuxos-drakconf.desktop" )
endif()
if(EXISTS "/usr/share/applications/mandriva-drakconf.desktop")
  set( KICKOFF_DIST_CONFIG_SHORTCUT1 "/usr/share/applications/mandriva-drakconf.desktop" )
endif()

##### Checks for a distribution-specific 2nd menu item, generally a shortcut to graphical package manager
if(EXISTS "/usr/share/applications/package-manager.desktop")
  set( KICKOFF_DIST_CONFIG_SHORTCUT2 "/usr/share/applications/package-manager.desktop" )
endif()
if(EXISTS "/usr/share/applications/rpmdrake.desktop")
  set( KICKOFF_DIST_CONFIG_SHORTCUT2 "/usr/share/applications/rpmdrake.desktop" )
endif()

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

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