8ec2bed83c3a191c2393b06a58c8a62a7797a57b
[quassel.git] / src / common / CMakeLists.txt
1 # Builds the common module
2
3 set(SOURCES
4     aliasmanager.cpp
5     authhandler.cpp
6     backlogmanager.cpp
7     basichandler.cpp
8     bufferinfo.cpp
9     buffersyncer.cpp
10     bufferviewconfig.cpp
11     bufferviewmanager.cpp
12     compressor.cpp
13     ctcpevent.cpp
14     dccconfig.cpp
15     event.cpp
16     eventmanager.cpp
17     highlightrulemanager.cpp
18     identity.cpp
19     ignorelistmanager.cpp
20     internalpeer.cpp
21     ircchannel.cpp
22     ircevent.cpp
23     irclisthelper.cpp
24     ircuser.cpp
25     logger.cpp
26     message.cpp
27     messageevent.cpp
28     network.cpp
29     networkconfig.cpp
30     networkevent.cpp
31     peer.cpp
32     peerfactory.cpp
33     presetnetworks.cpp
34     quassel.cpp
35     remotepeer.cpp
36     settings.cpp
37     signalproxy.cpp
38     syncableobject.cpp
39     transfer.cpp
40     transfermanager.cpp
41     types.cpp
42     util.cpp
43
44     serializers/serializers.cpp
45
46     protocols/datastream/datastreampeer.cpp
47     protocols/legacy/legacypeer.cpp
48
49     # needed for automoc
50     coreinfo.h
51     irccap.h
52     protocol.h
53 )
54
55 if (USE_QT5)
56     list(APPEND SOURCES qt5cliparser.cpp)
57 else()
58     list(APPEND SOURCES cliparser.cpp)
59 endif()
60
61 if (QCA2_FOUND OR QCA2-QT5_FOUND)
62     set(SOURCES ${SOURCES} keyevent.cpp)
63 endif()
64
65 if (ZLIB_FOUND)
66     add_definitions(-DHAVE_ZLIB)
67     include_directories(${ZLIB_INCLUDE_DIRS})
68 else()
69     set(SOURCES ${SOURCES} ../../3rdparty/miniz/miniz.c)
70 endif()
71
72 if (USE_QT4)
73     set(SOURCES ${SOURCES} ../../3rdparty/sha512/sha512.c)
74 endif()
75
76 if (HAVE_SYSLOG)
77     add_definitions(-DHAVE_SYSLOG)
78 endif()
79
80 if (APPLE)
81     set(SOURCES ${SOURCES} mac_utils.cpp)
82 endif()
83
84 if (WIN32)
85     set(SOURCES ${SOURCES} logbacktrace_win.cpp)
86 else()
87     if (EXECINFO_FOUND)
88         add_definitions(-DHAVE_EXECINFO)
89         include_directories(${EXECINFO_INCLUDES})
90     endif()
91     set(SOURCES ${SOURCES} logbacktrace_unix.cpp)
92 endif()
93
94 qt_add_resources(SOURCES ${COMMON_RCS})
95
96 add_library(mod_common STATIC ${SOURCES})
97 qt_use_modules(mod_common Core Network)
98
99 if (APPLE)
100     target_link_libraries(mod_common "-framework CoreServices" "-framework CoreFoundation")
101 endif()
102
103 target_link_libraries(mod_common ${CMAKE_DL_LIBS} ${EXECINFO_LIBRARIES})
104
105 if(ZLIB_FOUND)
106     target_link_libraries(mod_common ${ZLIB_LIBRARIES})
107 endif()
108
109 # This is needed so translations are generated before trying to build the qrc.
110 # Should probably find a nicer solution with proper dependencies between the involved files, though...
111 add_dependencies(mod_common po)