fix logic
[personal-kdelibs.git] / kdecore / CMakeLists.txt
blob06e2763b784921bf0570a8124ff416c7eb09194b
1 project(kdecore)
2 # Generate config-kstandarddirs.h
3 configure_file(config-kstandarddirs.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kstandarddirs.h )
5 # Generate kdefakes.h
6 configure_file(kdefakes.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdefakes.h )
8 # Generate kdeversion.h
9 configure_file(util/kdeversion.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdeversion.h )
11 # Configure checks for network/ but also for netsupp.*
12 include(network/ConfigureChecks.cmake)
13 configure_file(network/config-network.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/network/config-network.h )
14 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/network )
15 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/sonnet/ )
17 include_directories( ${KDE4_KDECORE_INCLUDES} )
18 include_directories( ${ZLIB_INCLUDE_DIR} )
19 include_directories( ${QT_INCLUDES} )
21 # kdecore_OPTIONAL_SRCS is used to collect source files
22 # which are not always compiled into kdecore
23 # if it's used, *always* append to it
24 set(kdecore_OPTIONAL_SRCS)
25 # same for optional libs
26 set(kdecore_OPTIONAL_LIBS)
28 if(WIN32)
29    set(kdecore_OPTIONAL_LIBS ${kdecore_OPTIONAL_LIBS} ${KDEWIN32_LIBRARIES})
30 endif(WIN32)
32 # Needed for the kdatetime test in release mode
33 if(KDE4_BUILD_TESTS)
34    add_definitions(-DCOMPILING_TESTS)
35 endif(KDE4_BUILD_TESTS)
37 # compile bzip2 support if available
38 if(BZIP2_FOUND)
39    include_directories(${BZIP2_INCLUDE_DIR})
40    set(kdecore_OPTIONAL_SRCS ${kdecore_OPTIONAL_SRCS} compression/kbzip2filter.cpp )
41    set(kdecore_OPTIONAL_LIBS ${kdecore_OPTIONAL_LIBS} ${BZIP2_LIBRARIES})
42 endif(BZIP2_FOUND)
44 # compile Gettext support if available
45 if(LIBINTL_FOUND)
46   include_directories(${LIBINTL_INCLUDE_DIR})
47   set(kdecore_OPTIONAL_LIBS ${kdecore_OPTIONAL_LIBS} ${LIBINTL_LIBRARIES})
48 endif(LIBINTL_FOUND)
50 if (HAVE_RESOLV_LIBRARY)
51   set(kdecore_OPTIONAL_LIBS ${kdecore_OPTIONAL_LIBS} resolv)
52 endif (HAVE_RESOLV_LIBRARY)
54 if (APPLE)
55    set(kdecore_OPTIONAL_SRCS ${kdecore_OPTIONAL_SRCS}
56       kernel/kkernel_mac.cpp
57    )
58    set(kdecore_OPTIONAL_LIBS ${kdecore_OPTIONAL_LIBS} ${CARBON_LIBRARY})
59 endif (APPLE)
61 if (WIN32)
62    set(kdecore_OPTIONAL_SRCS ${kdecore_OPTIONAL_SRCS}
63       kernel/kkernel_win.cpp
64       kernel/ktoolinvocation_win.cpp
65       kernel/kstandarddirs_win.cpp
66       network/klocalsocket_win.cpp
67       io/klockfile_win.cpp
68       util/kshell_win.cpp
69       util/kmacroexpander_win.cpp
70       util/kuser_win.cpp
71    )
72    if(NOT MSVC)
73    set(kdecore_OPTIONAL_SRCS ${kdecore_OPTIONAL_SRCS}
74       network/netsupp.cpp
75    )
76    endif(NOT MSVC)
77 endif (WIN32)
80 if (UNIX)
81    set(kdecore_OPTIONAL_SRCS ${kdecore_OPTIONAL_SRCS}
82       kernel/ktoolinvocation_x11.cpp 
83       kernel/kstandarddirs_unix.cpp
84       network/k3httpproxysocketdevice.cpp
85       network/k3socks.cpp
86       network/k3sockssocketdevice.cpp
87       network/klocalsocket_unix.cpp
88       network/netsupp.cpp
89       io/klockfile_unix.cpp
90       util/kshell_unix.cpp
91       util/kuser_unix.cpp
92       util/kmacroexpander_unix.cpp
93       fakes.c 
94    )
95 endif (UNIX)
98 add_subdirectory( kconfig_compiler )
99 add_subdirectory( tests )
100 add_subdirectory( sonnet/tests )
102 ########### next target ###############
104 if (UNIX)
106    kde4_add_library(kdefakes SHARED fakes.c)
107    set_target_properties(kdefakes PROPERTIES VERSION ${KDE_NON_GENERIC_LIB_VERSION} SOVERSION ${KDE_NON_GENERIC_LIB_SOVERSION})
108    if (NOT HAVE_TRUNC)
109        target_link_libraries(kdefakes  m )
110    endif (NOT HAVE_TRUNC)
111    install(TARGETS kdefakes EXPORT kdelibsLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS} )
113 endif (UNIX)
117 ########### next target ###############
119 set(kdecore_LIB_SRCS
120    compression/kgzipfilter.cpp
121    compression/kfilterbase.cpp
122    compression/kfilterdev.cpp
123    config/kconfig.cpp
124    config/kconfigbase.cpp
125    config/kconfiggroup.cpp
126    config/kconfigbackend.cpp
127    config/kconfigini.cpp
128    config/kdesktopfile.cpp
129    config/ksharedconfig.cpp
130    config/kcoreconfigskeleton.cpp
131    date/kcalendarsystem.cpp
132    date/kcalendarsystemgregorian.cpp
133    date/kcalendarsystemhijri.cpp
134    date/kcalendarsystemhebrew.cpp
135    date/kcalendarsystemjalali.cpp
136    date/kdatetime.cpp
137    date/ktimezone.cpp
138    date/ksystemtimezone.cpp
139    date/ktzfiletimezone.cpp
140    io/kautosavefile.cpp
141    io/kdebug.cpp
142    io/kdebugdbusiface.cpp
143    io/kmessage.cpp
144    io/kprocess.cpp
145    io/ksavefile.cpp
146    io/ktempdir.cpp
147    io/ktemporaryfile.cpp
148    io/kurl.cpp
149    jobs/kcompositejob.cpp
150    jobs/kjob.cpp
151    jobs/kjobuidelegate.cpp
152    jobs/kjobtrackerinterface.cpp
153    kernel/kauthorized.cpp
154    kernel/kautostart.cpp
155    kernel/kaboutdata.cpp
156    kernel/kcmdlineargs.cpp
157    kernel/kglobal.cpp
158    kernel/kcomponentdata.cpp
159    kernel/kstandarddirs.cpp
160    kernel/ktoolinvocation.cpp
161    services/kfoldermimetype.cpp
162    services/kmimetypefactory.cpp
163    services/kmimemagicrule.cpp
164    services/kmimetypetrader.cpp
165    services/kmimetype.cpp
166    services/kservice.cpp
167    services/kserviceaction.cpp
168    services/kservicefactory.cpp
169    services/kservicegroup.cpp
170    services/kservicegroupfactory.cpp
171    services/kserviceoffer.cpp
172    services/kservicetype.cpp
173    services/kservicetypefactory.cpp
174    services/kservicetypeprofile.cpp
175    services/kservicetypetrader.cpp
176    services/ktraderparse.cpp
177    services/ktraderparsetree.cpp
178    services/yacc.c
179    services/lex.c
180    services/kplugininfo.cpp
181    sonnet/loader.cpp
182    sonnet/client.cpp
183    sonnet/spellerplugin.cpp
184    sonnet/speller.cpp
185    sonnet/filter.cpp
186    sonnet/settings.cpp
187    sonnet/backgroundchecker.cpp
188    sonnet/backgroundengine.cpp
189    sonnet/globals.cpp
190    network/k3socketdevice.cpp # must be before the rest of network/, for enable-final
191    network/k3bufferedsocket.cpp
192    network/k3clientsocketbase.cpp
193    network/k3datagramsocket.cpp
194    network/k3resolver.cpp
195    network/k3resolvermanager.cpp
196    network/k3resolverworkerbase.cpp
197    network/k3resolverstandardworkers.cpp
198    network/k3reverseresolver.cpp
199    network/k3serversocket.cpp
200    network/k3socketaddress.cpp
201    network/k3socketbase.cpp
202    network/k3streamsocket.cpp
203    network/k3socketbuffer.cpp
204    network/klocalsocket.cpp
205    network/ksocketfactory.cpp
206    network/ktcpsocket.cpp
207    localization/kcatalog.cpp
208    localization/kcharsets.cpp
209    localization/kencodingdetector.cpp
210    localization/guess_ja.cpp
211    localization/kencodingprober.cpp
212    localization/probers/CharDistribution.cpp
213    localization/probers/ChineseGroupProber.cpp
214    localization/probers/JapaneseGroupProber.cpp
215    localization/probers/JpCntx.cpp
216    localization/probers/LangBulgarianModel.cpp
217    localization/probers/LangCyrillicModel.cpp
218    localization/probers/LangGreekModel.cpp
219    localization/probers/LangHebrewModel.cpp
220    localization/probers/LangHungarianModel.cpp
221    localization/probers/LangThaiModel.cpp
222    localization/probers/UnicodeGroupProber.cpp
223    localization/probers/nsBig5Prober.cpp
224    localization/probers/nsCharSetProber.cpp
225    localization/probers/nsEUCJPProber.cpp
226    localization/probers/nsEUCKRProber.cpp
227    localization/probers/nsEUCTWProber.cpp
228    localization/probers/nsEscCharsetProber.cpp
229    localization/probers/nsEscSM.cpp
230    localization/probers/nsGB2312Prober.cpp
231    localization/probers/nsHebrewProber.cpp
232    localization/probers/nsLatin1Prober.cpp
233    localization/probers/nsMBCSGroupProber.cpp
234    localization/probers/nsMBCSSM.cpp
235    localization/probers/nsSBCSGroupProber.cpp
236    localization/probers/nsSBCharSetProber.cpp
237    localization/probers/nsSJISProber.cpp
238    localization/probers/nsUniversalDetector.cpp
239    localization/klocale.cpp
240    localization/klocalizedstring.cpp
241    localization/ktranslit.cpp
242    localization/kuitsemantics.cpp
243    localization/kuitformats.cpp
244    localization/common_helpers.cpp
245    sycoca/ksycoca.cpp
246    sycoca/ksycocadict.cpp
247    sycoca/ksycocaentry.cpp
248    sycoca/ksycocafactory.cpp
249    sycoca/kprotocolinfo.cpp
250    sycoca/kprotocolinfofactory.cpp
251    sycoca/kmemfile.cpp
252    text/kascii.cpp
253    text/kcodecs.cpp
254    text/kstringhandler.cpp
255    util/kallocator.cpp
256    util/kdedmodule.cpp
257    util/kdeversion.cpp
258    util/klauncher_iface.cpp
259    util/klibloader.cpp
260    util/klibrary.cpp
261    util/kmacroexpander.cpp
262    util/kpluginfactory.cpp
263    util/kpluginloader.cpp
264    util/kshell.cpp
265    util/krandom.cpp
266    util/krandomsequence.cpp
267    util/qtest_kde.cpp
268    ${kdecore_OPTIONAL_SRCS}
272 if (NOT Q_WS_X11 AND NOT Q_WS_QWS)
273    add_definitions(-DNO_DISPLAY)
274 endif (NOT Q_WS_X11 AND NOT Q_WS_QWS)
276 kde4_add_library(kdecore SHARED ${kdecore_LIB_SRCS})
278 target_link_libraries(kdecore ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTDBUS_LIBRARY} ${QT_QTXML_LIBRARY} ${ZLIB_LIBRARY} ${kdecore_OPTIONAL_LIBS})
280 if(WIN32)
281   set(kdecore_LINK_INTERFACE_LIBRARIES  ${QT_QTDBUS_LIBRARY} ${QT_QTCORE_LIBRARY} ${KDEWIN32_LIBRARIES})
282 else(WIN32)
283   if(APPLE)
284     set(kdecore_LINK_INTERFACE_LIBRARIES ${QT_QTDBUS_LIBRARY} ${QT_QTCORE_LIBRARY} ${CARBON_LIBRARY})
285   else(APPLE)
286     set(kdecore_LINK_INTERFACE_LIBRARIES ${QT_QTDBUS_LIBRARY} ${QT_QTCORE_LIBRARY} )
287   endif(APPLE)
288 endif(WIN32)
290 target_link_libraries(kdecore LINK_INTERFACE_LIBRARIES ${kdecore_LINK_INTERFACE_LIBRARIES} )
292 set_target_properties(kdecore PROPERTIES 
293                               VERSION ${KDE_NON_GENERIC_LIB_VERSION} 
294                               SOVERSION ${KDE_NON_GENERIC_LIB_SOVERSION}
295                      )
298 install(TARGETS kdecore EXPORT kdelibsLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
300 ########### next target ###############
302 configure_file(all_languages.desktop ${CMAKE_CURRENT_BINARY_DIR}/all_languages @ONLY)  
304 kde4_add_executable(kde4-config NOGUI kde-config.cpp )
306 target_link_libraries(kde4-config ${KDE4_KDECORE_LIBS} )
308 install(TARGETS kde4-config ${INSTALL_TARGETS_DEFAULT_ARGS} )
311 ########### next target ###############
313 if (WIN32)
314     kde4_add_executable(kcmdwrapper NOGUI io/kcmdwrapper.cpp )
316     target_link_libraries(kcmdwrapper kernel32 shell32 )
318     install(TARGETS kcmdwrapper DESTINATION ${LIBEXEC_INSTALL_DIR} )
319 endif (WIN32)
321 ########### next target ###############
323 # kjs hash stuff for transcript plugin
324 set( CREATE_HASH_TABLE ${CMAKE_SOURCE_DIR}/kjs/create_hash_table )
326 add_custom_command(
327    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ktranscript.lut.h
328    COMMAND ${PERL_EXECUTABLE} ${CREATE_HASH_TABLE}
329            ${CMAKE_CURRENT_SOURCE_DIR}/localization/ktranscript.cpp
330            > ${CMAKE_CURRENT_BINARY_DIR}/ktranscript.lut.h
331    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/localization/ktranscript.cpp
334 # the transcript plugin
335 set( ktranscript_LIB_SRCS
336    localization/ktranscript.cpp
337    localization/common_helpers.cpp
340 kde4_add_plugin( ktranscript ${ktranscript_LIB_SRCS} )
342 target_link_libraries( ktranscript kjs ${QT_QTCORE_LIBRARY} )
345 if(KDE4_ENABLE_FINAL)
346    macro_add_file_dependencies(${CMAKE_CURRENT_BINARY_DIR}/ktranscript_final_cpp.cpp ${CMAKE_CURRENT_BINARY_DIR}/ktranscript.lut.h)
347 else(KDE4_ENABLE_FINAL)
348    macro_add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/localization/ktranscript.cpp ${CMAKE_CURRENT_BINARY_DIR}/ktranscript.lut.h)
349 endif(KDE4_ENABLE_FINAL)
351 install( TARGETS ktranscript DESTINATION ${PLUGIN_INSTALL_DIR} )
353 ########### install files ###############
354 install( FILES ${CMAKE_CURRENT_BINARY_DIR}/all_languages DESTINATION ${LOCALE_INSTALL_DIR}  )
355 install( FILES kdebug.areas kdebugrc DESTINATION ${CONFIG_INSTALL_DIR} )
356 install( FILES
357    kdecore_export.h
358    compression/kfilterbase.h
359    compression/kfilterdev.h
360    config/conversion_check.h
361    config/kconfig.h
362    #config/kconfigbackend.h re-enable post-API review and implementation (4.2?)
363    config/kconfigbase.h
364    config/kconfiggroup.h
365    config/kdesktopfile.h
366    config/ksharedconfig.h
367    config/kcoreconfigskeleton.h
368    date/kcalendarsystem.h
369    date/kdatetime.h
370    date/ksystemtimezone.h
371    date/ktimezone.h
372    date/ktzfiletimezone.h
373    io/kautosavefile.h
374    io/kdebug.h
375    io/kmessage.h
376    io/kprocess.h
377    io/klockfile.h
378    io/ksavefile.h
379    io/ktempdir.h
380    io/ktemporaryfile.h
381    io/kurl.h
382    jobs/kcompositejob.h
383    jobs/kjob.h
384    jobs/kjobuidelegate.h
385    jobs/kjobtrackerinterface.h
386    kernel/kaboutdata.h
387    kernel/kauthorized.h
388    kernel/kautostart.h
389    kernel/kcmdlineargs.h
390    kernel/kglobal.h
391    kernel/kcomponentdata.h
392    kernel/kstandarddirs.h
393    kernel/ktoolinvocation.h
394    network/k3bufferedsocket.h
395    network/k3clientsocketbase.h
396    network/k3datagramsocket.h
397    network/k3httpproxysocketdevice.h
398    network/k3resolver.h
399    network/k3reverseresolver.h
400    network/k3serversocket.h
401    network/k3socketaddress.h
402    network/k3socketbase.h
403    network/k3socketdevice.h
404    network/k3socks.h
405    network/k3sockssocketdevice.h
406    network/k3streamsocket.h
407    network/klocalsocket.h
408    network/ksocketfactory.h
409    services/kmimetype.h
410    services/kmimetypetrader.h
411    services/kservice.h
412    services/kserviceaction.h
413    services/kservicegroup.h
414    #services/kservicefactory.h: do not install, internal API
415    services/kservicetype.h
416    #services/kservicetypefactory.h: do not install, internal API
417    services/kservicetypeprofile.h
418    services/kservicetypetrader.h
419    #services/kserviceoffer.h: do not install, internal API
420    services/kplugininfo.h
421    localization/kcharsets.h
422    localization/kencodingdetector.h
423    localization/kencodingprober.h
424    localization/klocale.h
425    localization/klocalizedstring.h
426    sycoca/kprotocolinfo.h
427    sycoca/ksycoca.h
428    sycoca/ksycocaentry.h
429    sycoca/ksycocatype.h
430    text/kascii.h
431    text/kcodecs.h
432    text/kstringhandler.h
433    util/kallocator.h
434    util/kde_file.h
435    util/kdedmodule.h
436    util/kgenericfactory.h
437    util/kgenericfactory.tcc
438    util/klauncher_iface.h
439    util/klibloader.h
440    util/klibrary.h
441    util/kmacroexpander.h
442    util/kexportplugin.h
443    util/kpluginfactory.h
444    util/kpluginloader.h
445    util/kshell.h
446    util/krandom.h
447    util/krandomsequence.h
448    util/ksharedptr.h
449    util/ksortablelist.h
450    util/ktypelist.h
451    util/kuser.h
452    util/qtest_kde.h
453    ${CMAKE_CURRENT_BINARY_DIR}/kdefakes.h
454    ${CMAKE_CURRENT_BINARY_DIR}/kdeversion.h
455    DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
458 install( FILES sonnet/backgroundchecker.h sonnet/speller.h sonnet/globals.h
459          DESTINATION ${INCLUDE_INSTALL_DIR}/sonnet COMPONENT Devel)
461 install( FILES
462    config/kconfigbackend.desktop
463    services/kplugininfo.desktop
464    sonnet/sonnetspeller.desktop
465    DESTINATION  ${SERVICETYPES_INSTALL_DIR}