]> granicus.if.org Git - icinga2/blob - lib/base/CMakeLists.txt
1c831ba24ae31e40d03f4e27311b45d430180643
[icinga2] / lib / base / CMakeLists.txt
1 # Icinga 2
2 # Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org)
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation
16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 mkclass_target(application.ti application.thpp)
19 mkclass_target(dynamicobject.ti dynamicobject.thpp)
20 mkclass_target(filelogger.ti filelogger.thpp)
21 mkclass_target(logger.ti logger.thpp)
22 mkclass_target(streamlogger.ti streamlogger.thpp)
23 mkclass_target(sysloglogger.ti sysloglogger.thpp)
24
25 set(base_SOURCES
26   application.cpp application.thpp array.cpp configerror.cpp console.cpp context.cpp
27   convert.cpp debuginfo.cpp dictionary.cpp dynamicobject.cpp dynamicobject.thpp dynamictype.cpp
28   exception.cpp fifo.cpp filelogger.cpp filelogger.thpp logger.cpp logger.thpp
29   netstring.cpp networkstream.cpp object.cpp objectlock.cpp process.cpp
30   ringbuffer.cpp scriptfunction.cpp scriptfunctionwrapper.cpp
31   scriptutils.cpp scriptvariable.cpp serializer.cpp socket.cpp stacktrace.cpp
32   statsfunction.cpp stdiostream.cpp stream.cpp streamlogger.cpp streamlogger.thpp string.cpp 
33   sysloglogger.cpp sysloglogger.thpp tcpsocket.cpp threadpool.cpp timer.cpp
34   tlsstream.cpp tlsutility.cpp type.cpp unixsocket.cpp utility.cpp value.cpp
35   value-operators.cpp workqueue.cpp
36 )
37
38 if(ICINGA2_UNITY_BUILD)
39     mkunity_target(base base_SOURCES)
40 endif()
41
42 add_library(base SHARED ${base_SOURCES})
43
44 target_link_libraries(base ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} cJSON mmatch)
45
46 if(HAVE_LIBEXECINFO)
47     target_link_libraries(base execinfo)
48 endif()
49
50 include_directories(${icinga2_SOURCE_DIR}/third-party/cJSON)
51 link_directories(${icinga2_BINARY_DIR}/third-party/cJSON)
52
53 include_directories(${icinga2_SOURCE_DIR}/third-party/execvpe)
54 link_directories(${icinga2_BINARY_DIR}/third-party/execvpe)
55
56 include_directories(${icinga2_SOURCE_DIR}/third-party/mmatch)
57 link_directories(${icinga2_BINARY_DIR}/third-party/mmatch)
58
59 if(UNIX OR CYGWIN)
60   target_link_libraries(base execvpe)
61 endif()
62
63 if(WIN32)
64   target_link_libraries(base ws2_32 dbghelp shlwapi)
65 endif()
66
67 set_target_properties (
68   base PROPERTIES
69   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
70   DEFINE_SYMBOL I2_BASE_BUILD
71   FOLDER Lib
72 )
73
74 install(
75   TARGETS base
76   RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
77   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
78 )