]> granicus.if.org Git - icinga2/blob - icinga-app/CMakeLists.txt
DB IDO: Do not deactivate objects during application reload/restart
[icinga2] / icinga-app / CMakeLists.txt
1 # Icinga 2
2 # Copyright (C) 2012-2018 Icinga Development Team (https://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 if(MSVC)
19   set(WindowsSources icinga.rc)
20 else()
21   set(WindowsSources "")
22 endif()
23
24 set(icingaloader_SOURCES
25   icinga.cpp
26   ${WindowsSources}
27 )
28
29 add_library(icingaloader OBJECT ${icingaloader_SOURCES})
30 add_dependencies(icingaloader base config cli)
31
32 set_target_properties (
33   icingaloader PROPERTIES
34   FOLDER Lib
35 )
36
37 include_directories(${Boost_INCLUDE_DIRS})
38
39 if(ICINGA2_WITH_CHECKER)
40   list(APPEND icinga_app_SOURCES $<TARGET_OBJECTS:checker>)
41 endif()
42
43 if(ICINGA2_WITH_COMPAT)
44   list(APPEND icinga_app_SOURCES $<TARGET_OBJECTS:compat>)
45 endif()
46
47 if(ICINGA2_WITH_MYSQL OR ICINGA2_WITH_PGSQL)
48   list(APPEND icinga_app_SOURCES $<TARGET_OBJECTS:db_ido>)
49 endif()
50
51 if(ICINGA2_WITH_MYSQL)
52   list(APPEND icinga_app_SOURCES $<TARGET_OBJECTS:db_ido_mysql>)
53 endif()
54
55 if(ICINGA2_WITH_PGSQL)
56   list(APPEND icinga_app_SOURCES $<TARGET_OBJECTS:db_ido_pgsql>)
57 endif()
58
59 if(ICINGA2_WITH_LIVESTATUS)
60   list(APPEND icinga_app_SOURCES $<TARGET_OBJECTS:livestatus>)
61 endif()
62
63 if(ICINGA2_WITH_NOTIFICATION)
64   list(APPEND icinga_app_SOURCES $<TARGET_OBJECTS:notification>)
65 endif()
66
67 if(ICINGA2_WITH_PERFDATA)
68   list(APPEND icinga_app_SOURCES $<TARGET_OBJECTS:perfdata>)
69 endif()
70
71 add_executable(icinga-app
72   $<TARGET_OBJECTS:icingaloader>
73   ${base_OBJS}
74   $<TARGET_OBJECTS:config>
75   $<TARGET_OBJECTS:remote>
76   $<TARGET_OBJECTS:cli>
77   $<TARGET_OBJECTS:icinga>
78   $<TARGET_OBJECTS:methods>
79   ${icinga_app_SOURCES}
80 )
81
82 target_link_libraries(icinga-app ${base_DEPS})
83
84 set_target_properties (
85   icinga-app PROPERTIES
86   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
87   FOLDER Bin
88   OUTPUT_NAME icinga2
89 )
90
91 if(WIN32)
92   set(InstallPath "${CMAKE_INSTALL_SBINDIR}")
93 else()
94   configure_file(icinga2.cmake ${CMAKE_CURRENT_BINARY_DIR}/icinga2 @ONLY)
95
96   install(
97     FILES ${CMAKE_CURRENT_BINARY_DIR}/icinga2
98     DESTINATION ${CMAKE_INSTALL_SBINDIR}
99     PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
100   )
101
102   set(InstallPath "${CMAKE_INSTALL_LIBDIR}/icinga2/sbin")
103 endif()
104
105 install(
106   TARGETS icinga-app
107   RUNTIME DESTINATION ${InstallPath}
108 )
109
110 install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_LOGDIR}\")")
111 install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}\")")
112 install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_INITRUNDIR}\")")