]> granicus.if.org Git - icinga2/blob - plugins/CMakeLists.txt
Enhance the addon chapter in the docs
[icinga2] / plugins / 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 add_executable(check_nscp_api
19   check_nscp_api.cpp
20   ${base_OBJS}
21   $<TARGET_OBJECTS:config>
22   $<TARGET_OBJECTS:remote>
23 )
24 target_link_libraries(check_nscp_api ${base_DEPS})
25 set_target_properties (
26   check_nscp_api PROPERTIES
27   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
28   DEFINE_SYMBOL I2_PLUGINS_BUILD
29   FOLDER Plugins)
30
31 # Prefer the PluginDir constant which is set to /sbin on Windows
32
33 if(WIN32)
34   install(TARGETS check_nscp_api RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
35 else()
36   install(TARGETS check_nscp_api RUNTIME DESTINATION ${ICINGA2_PLUGINDIR})
37 endif()
38
39 if (WIN32)
40   add_definitions(-DUNICODE -D_UNICODE)
41
42   set(thresholds_SOURCES
43     thresholds.cpp thresholds.hpp
44   )
45
46   add_library(thresholds ${thresholds_SOURCES})
47
48   set_target_properties(
49     thresholds PROPERTIES
50     INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
51     FOLDER Plugins
52   )
53
54   set(check_SOURCES
55     check_disk.cpp check_load.cpp check_memory.cpp check_network.cpp check_perfmon.cpp
56     check_ping.cpp check_procs.cpp check_service.cpp check_swap.cpp check_update.cpp check_uptime.cpp
57     check_users.cpp
58   )
59
60   foreach(source ${check_SOURCES})
61     string(REGEX REPLACE ".cpp\$" "" check_OUT "${source}")
62
63     add_executable(${check_OUT} ${source})
64     target_link_libraries(${check_OUT} thresholds shlwapi.lib ${Boost_PROGRAM_OPTIONS_LIBRARY})
65
66     set_target_properties(
67       ${check_OUT} PROPERTIES
68       INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
69       DEFINE_SYMBOL I2_PLUGINS_BUILD
70       FOLDER Plugins
71     )
72   endforeach()
73
74   target_link_libraries(check_load pdh.lib)
75   target_link_libraries(check_network pdh.lib iphlpapi.lib)
76   target_link_libraries(check_perfmon pdh.lib)
77   target_link_libraries(check_ping ntdll.lib iphlpapi.lib ws2_32.lib)
78   target_link_libraries(check_procs pdh.lib)
79   target_link_libraries(check_uptime ${Boost_SYSTEM_LIBRARY})
80   target_link_libraries(check_users wtsapi32.lib)
81
82   install(
83     TARGETS check_disk check_load check_memory check_network check_perfmon check_procs
84       check_ping check_service check_swap check_update check_uptime check_users
85     RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
86   )
87 endif ( )