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