]> granicus.if.org Git - icinga2/blob - lib/base/CMakeLists.txt
Move PerfdataValue() class into base library
[icinga2] / lib / base / CMakeLists.txt
1 # Icinga 2
2 # Copyright (C) 2012-2017 Icinga Development Team (https://www.icinga.com/)
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.tcpp application.thpp)
19 mkclass_target(configobject.ti configobject.tcpp configobject.thpp)
20 mkclass_target(datetime.ti datetime.tcpp datetime.thpp)
21 mkclass_target(filelogger.ti filelogger.tcpp filelogger.thpp)
22 mkclass_target(function.ti function.tcpp function.thpp)
23 mkclass_target(logger.ti logger.tcpp logger.thpp)
24 mkclass_target(perfdatavalue.ti perfdatavalue.tcpp perfdatavalue.thpp)
25 mkclass_target(streamlogger.ti streamlogger.tcpp streamlogger.thpp)
26 mkclass_target(sysloglogger.ti sysloglogger.tcpp sysloglogger.thpp)
27
28 set(base_SOURCES
29   application.cpp application.thpp application-version.cpp array.cpp
30   array-script.cpp boolean.cpp boolean-script.cpp console.cpp context.cpp
31   convert.cpp datetime.cpp datetime.thpp datetime-script.cpp debuginfo.cpp dictionary.cpp dictionary-script.cpp
32   configobject.cpp configobject.thpp configobject-script.cpp configtype.cpp configwriter.cpp dependencygraph.cpp
33   exception.cpp fifo.cpp filelogger.cpp filelogger.thpp initialize.cpp json.cpp
34   json-script.cpp loader.cpp logger.cpp logger.thpp math-script.cpp
35   netstring.cpp networkstream.cpp number.cpp number-script.cpp object.cpp
36   object-script.cpp objecttype.cpp primitivetype.cpp process.cpp ringbuffer.cpp scriptframe.cpp
37   function.cpp function.thpp function-script.cpp functionwrapper.cpp
38   perfdatavalue.cpp perfdatavalue.thpp scriptglobal.cpp
39   scriptutils.cpp serializer.cpp socket.cpp socketevents.cpp socketevents-epoll.cpp socketevents-poll.cpp stacktrace.cpp
40   statsfunction.cpp stdiostream.cpp stream.cpp streamlogger.cpp streamlogger.thpp string.cpp string-script.cpp
41   sysloglogger.cpp sysloglogger.thpp tcpsocket.cpp udpsocket.cpp threadpool.cpp timer.cpp
42   tlsstream.cpp tlsutility.cpp type.cpp typetype-script.cpp unixsocket.cpp utility.cpp value.cpp
43   value-operators.cpp workqueue.cpp
44 )
45
46 set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/application-version.cpp PROPERTY EXCLUDE_UNITY_BUILD TRUE)
47
48 if(ICINGA2_UNITY_BUILD)
49     mkunity_target(base base base_SOURCES)
50 endif()
51
52 add_library(base SHARED ${base_SOURCES})
53
54 target_link_libraries(base ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${YAJL_LIBRARIES} mmatch socketpair)
55
56 if(HAVE_LIBEXECINFO)
57     target_link_libraries(base execinfo)
58 endif()
59
60 include_directories(${icinga2_SOURCE_DIR}/third-party/execvpe)
61 link_directories(${icinga2_BINARY_DIR}/third-party/execvpe)
62
63 include_directories(${icinga2_SOURCE_DIR}/third-party/mmatch)
64 link_directories(${icinga2_BINARY_DIR}/third-party/mmatch)
65
66 include_directories(${icinga2_SOURCE_DIR}/third-party/socketpair)
67 link_directories(${icinga2_BINARY_DIR}/third-party/socketpair)
68
69 if(UNIX OR CYGWIN)
70   target_link_libraries(base execvpe)
71 endif()
72
73 if(WIN32)
74   target_link_libraries(base ws2_32 dbghelp shlwapi msi)
75 endif()
76
77 set_target_properties (
78   base PROPERTIES
79   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
80   DEFINE_SYMBOL I2_BASE_BUILD
81   FOLDER Lib
82   VERSION ${SPEC_VERSION}
83 )
84
85 install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/cache/icinga2\")")
86 install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/icinga2/crash\")")
87
88 install(
89   TARGETS base
90   RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
91   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2
92 )
93
94 if(APPLE)
95   install(
96     TARGETS base
97     LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}/icinga-studio.app/Contents
98   )
99 endif()
100
101 set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)