summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: fb6daabd33a70684fafb4e741b67a47f586b7591 (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
#################################################
#
#  (C) 2010-2011 Serghei Amelian
#  serghei (DOT) amelian (AT) gmail.com
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

cmake_minimum_required( VERSION 3.5 )


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

project( tdepim )
set( PACKAGE tdepim )


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

include( FindPkgConfig )
include( CheckIncludeFile )
include( CheckTypeSize )
include( CheckCSourceCompiles )
include( CheckCXXSourceCompiles )
include( CheckLibraryExists )
include( CheckSymbolExists )
enable_testing( )


##### 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_ARTS "Enable aRts support" ${WITH_ALL_OPTIONS} )
option( WITH_SASL "Enable cyrus-sasl support" ${WITH_ALL_OPTIONS} )
option( WITH_NEWDISTRLISTS "Enable the new distribution lists" ON )
option( WITH_GNOKII "Enable gnokii support" ${WITH_ALL_OPTIONS} )
option( WITH_EXCHANGE "Enable Microsoft Exchange 2000 support" ${WITH_ALL_OPTIONS} )
option( WITH_EGROUPWARE "Enable egroupware support" ${WITH_ALL_OPTIONS} )
option( WITH_KOLAB "Enable kolab support" ${WITH_ALL_OPTIONS} )
option( WITH_SLOX "Enable slox support" ${WITH_ALL_OPTIONS} )
option( WITH_GROUPWISE "Enable groupwise support" ${WITH_ALL_OPTIONS} )
option( WITH_FEATUREPLAN "Enable featureplan support" ${WITH_ALL_OPTIONS} )
option( WITH_GROUPDAV "Enable groupdav support" ${WITH_ALL_OPTIONS} )
option( WITH_BIRTHDAYS "Enable birthdays support" ${WITH_ALL_OPTIONS} )
option( WITH_NEWEXCHANGE "Enable newexchange support" ${WITH_ALL_OPTIONS} )
option( WITH_SCALIX "Enable scalix support" ${WITH_ALL_OPTIONS} )
option( WITH_CALDAV "Enable caldav support" ${WITH_ALL_OPTIONS} )
option( WITH_CARDDAV "Enable carddav support" ${WITH_ALL_OPTIONS} )
option( WITH_INDEXLIB "Enable indexlib support (in kmail)" ${WITH_ALL_OPTIONS} )
option( WITH_XSCREENSAVER "Enable xscreensaver support (idle detection in karm)" ${WITH_ALL_OPTIONS} )

if( NOT WITH_ARTS )
  set( WITHOUT_ARTS 1 )
endif( )

if( WITH_NEWDISTRLISTS )
  set( TDEPIM_NEW_DISTRLISTS 1 )
endif( )


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

# WITH_ARTS   affects kalarm
# WITH_ARTS   description without arts kalarm won't play sounds
#                         with messages.
# WITH_SASL   affects tdeioslave(sieve imap4)
# WITH_SASL   description sieve tdeioslave won't build without sasl and 
#	                      imap4 tdeioslave will lose the ability of SASL
#	                      authentification
# WITH_SASL   requires libgsasl
# WITH_NEWDISTRLISTS affects kabc kadressbook
# WITH_NEWDISTRLISTS description if set use new version of the KAB
#                                Distribution Mail List Plugin otherwise use
#                                the old one.
# 
# WITH_GNOKII        affects kphonebook kmobile
# WITH_GNOKII        description in kphonebook gnoki adds some
#                                phone-synchronization features
# WITH_EXCHANGE      affects tderesources korganizer
# WITH_EGROUPWARE    affects tderesources wizards
# WITH_KOLAB         affects tderesources wizards
# WITH_SLOX          affects tderesources wizards
# WITH_GROUPWISE     affects tderesources wizards
# WITH_FEATUREPLAN   affects tderesources
# WITH_GROUPDAV      affects tderesources
# WITH_BIRTHDAYS     affects tderesources
# WITH_NEWEXCHANGE   affects tderesources wizards
# WITH_SCALIX        affects tderesources wizards
# WITH_CALDAV        affects tderesources
# WITH_CARDDAV       affects tderesources
# WITH_INDEXLIB      affects kmail


# NOTE: WITH_GNOKII support in kmobile is outdated and permanently disabled
#       for now
# NOTE: WITH_{EGROUPWARE,KOLAB,SLOX,GROUPWISE,FEATUREPLAN,GROUPDAV,BIRTHDAYS,
#             NEWEXCHANGE,SCALIX,CALDAV,CARDDAV} in tderesources selects which
#       its modules would be built. 


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

option( BUILD_ALL "Build all" OFF )
option( BUILD_INDEXLIB "Build indexlib" ${BUILD_ALL} )
option( BUILD_LIBKMIME "Build libkmime" ${BUILD_ALL} )
option( BUILD_KTNEF "Build ktnef" ${BUILD_ALL} )
option( BUILD_LIBKCAL "Build libkcal" ${BUILD_ALL} )
option( BUILD_LIBTDEPIM "Build libtdepim" ${BUILD_ALL} )
option( BUILD_LIBKPIMIDENTITIES "Build libkpimidentities" ${BUILD_ALL} )
option( BUILD_LIBTDENETWORK "Build libtdenetwork" ${BUILD_ALL} )
option( BUILD_CERTMANAGER "Build certmanager" ${BUILD_ALL} )
option( BUILD_LIBKPGP "Build libkpgp" ${BUILD_ALL} )
option( BUILD_MIMELIB "Build mimelib" ${BUILD_ALL} )
option( BUILD_LIBKSIEVE "Build libksieve" ${BUILD_ALL} )
option( BUILD_LIBKPIMEXCHANGE "Build libkpimexchange" ${BUILD_ALL} )
option( BUILD_TDEIOSLAVE "Build tdeioslave" ${BUILD_ALL} )
option( BUILD_KMAIL "Build kmail" ${BUILD_ALL} )
option( BUILD_AKREGATOR "Build akregator" ${BUILD_ALL} )
option( BUILD_KALARM "Build kalarm" ${BUILD_ALL} )
option( BUILD_KADDRESSBOOK "Build kaddressbook" ${BUILD_ALL} )
option( BUILD_KORN "Build korn" ${BUILD_ALL} )
option( BUILD_KGANTT "Build kgantt" ${BUILD_ALL} )
option( BUILD_LIBKHOLIDAYS "Build libkholidays" ${BUILD_ALL} )
option( BUILD_KORGANIZER "Build korganizer" ${BUILD_ALL} )
option( BUILD_PLUGINS "Build plugins" ${BUILD_ALL} )
option( BUILD_KNOTES "Build knotes" ${BUILD_ALL} )
option( BUILD_KODE "Build kode" ${BUILD_ALL} )
option( BUILD_TDERESOURCES "Build tderesources" ${BUILD_ALL} )
option( BUILD_WIZARDS "Build wizards" ${BUILD_ALL} )
option( BUILD_TDEABC "Build tdeabc" ${BUILD_ALL} )
option( BUILD_KONSOLEKALENDAR "Build konsolekalendar" ${BUILD_ALL} )
option( BUILD_KMAILCVT "Build kmailcvt" ${BUILD_ALL} )
option( BUILD_KARM "Build karm" ${BUILD_ALL} )
option( BUILD_TDEFILE_PLUGINS "Build tdefile-plugins" ${BUILD_ALL} )
option( BUILD_KANDY "Build kandy" ${BUILD_ALL} )
option( BUILD_KNODE "Build knode" ${BUILD_ALL} )
option( BUILD_KMOBILE "Build kmobile" ${BUILD_ALL} )
option( BUILD_DOC "Build doc" ${BUILD_ALL} )
option( BUILD_KONTACT "Build kontact" ${BUILD_ALL} )


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


##### activate dependencies #####################

if( BUILD_LIBKCAL OR BUILD_LIBTDEPIM OR BUILD_LIBKPIMIDENTITIES OR BUILD_TDEIOSLAVE OR BUILD_KMAIL OR BUILD_KNODE )
  add_subdirectory( libemailfunctions )
endif()

if( BUILD_KADDRESSBOOK OR (BUILD_TDERESOURCES AND (WITH_EGROUPWARE OR WITH_BIRTHDAYS)) )
    add_subdirectory( kaddressbook/common )
endif()


##### tdepim directories ########################

tde_conditional_add_subdirectory( BUILD_INDEXLIB indexlib )
tde_conditional_add_subdirectory( BUILD_LIBKMIME libkmime )
tde_conditional_add_subdirectory( BUILD_KTNEF ktnef )
tde_conditional_add_subdirectory( BUILD_LIBKCAL libkcal )
tde_conditional_add_subdirectory( BUILD_LIBTDEPIM pixmaps )
tde_conditional_add_subdirectory( BUILD_LIBTDEPIM libtdepim )
tde_conditional_add_subdirectory( BUILD_LIBKPIMIDENTITIES libkpimidentities )
tde_conditional_add_subdirectory( BUILD_LIBTDENETWORK libtdenetwork )
tde_conditional_add_subdirectory( BUILD_CERTMANAGER certmanager )
tde_conditional_add_subdirectory( BUILD_LIBKPGP libkpgp )
tde_conditional_add_subdirectory( BUILD_MIMELIB mimelib )
tde_conditional_add_subdirectory( BUILD_LIBKSIEVE libksieve )
tde_conditional_add_subdirectory( BUILD_LIBKPIMEXCHANGE libkpimexchange )
tde_conditional_add_subdirectory( BUILD_TDEIOSLAVE tdeioslave )
tde_conditional_add_subdirectory( BUILD_KMAIL kmail )
tde_conditional_add_subdirectory( BUILD_AKREGATOR akregator )
tde_conditional_add_subdirectory( BUILD_KALARM kalarm )
tde_conditional_add_subdirectory( BUILD_KADDRESSBOOK kaddressbook )
tde_conditional_add_subdirectory( BUILD_KORN korn )
tde_conditional_add_subdirectory( BUILD_KGANTT kgantt )
tde_conditional_add_subdirectory( BUILD_LIBKHOLIDAYS libkholidays )
tde_conditional_add_subdirectory( BUILD_KORGANIZER kdgantt )
tde_conditional_add_subdirectory( BUILD_KORGANIZER korganizer )
tde_conditional_add_subdirectory( BUILD_PLUGINS plugins )
tde_conditional_add_subdirectory( BUILD_KNOTES knotes )
tde_conditional_add_subdirectory( BUILD_KODE kode )
tde_conditional_add_subdirectory( BUILD_TDERESOURCES tderesources )
tde_conditional_add_subdirectory( BUILD_WIZARDS wizards )
tde_conditional_add_subdirectory( BUILD_TDEABC tdeabc )
tde_conditional_add_subdirectory( BUILD_KONSOLEKALENDAR konsolekalendar )
tde_conditional_add_subdirectory( BUILD_KMAILCVT kmailcvt )
tde_conditional_add_subdirectory( BUILD_KARM karm )
tde_conditional_add_subdirectory( BUILD_TDEFILE_PLUGINS tdefile-plugins )
tde_conditional_add_subdirectory( BUILD_KANDY kandy )
tde_conditional_add_subdirectory( BUILD_KNODE knode )
tde_conditional_add_subdirectory( BUILD_KMOBILE kmobile )
tde_conditional_add_subdirectory( BUILD_DOC doc )
tde_conditional_add_subdirectory( BUILD_KONTACT kontact )


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

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